c
i mean in my case I want split a vector of 6 into 2 bucket with each has 3 items
c
i think i get it
c
thank you both~
Kartik nain
Hi
András
Kartik nain
#include<stdio.h> Main() { Printf("hello friends") ; return 0;
András
#include<stdio.h> Main() { Printf("hello friends") ; return 0;
compilation error: unexpected "friends" used
Kartik nain
compilation error: unexpected "friends" used
I can't enter friends in the field?
Anil
#include<stdio.h> Main() { Printf("hii I am anil") ; return 0;
Hubert
#include<stdio.h> Main() { Printf("hii I am anil") ; return 0;
Compile error : expected a "}" after ";"
Dima
dafuq
RishiGss
/rules
Anil
😇😇
Anonymous
Hello
klimi
Hello
cr0n0s
Hi!!!
Dima
welcome
Kartik nain
If else if
klimi
Hiiii
Volad Malevich
hi, folks. have a prob with code. Could you help me?
Volad Malevich
i have 2 errors in one line
Volad Malevich
Volad Malevich
Volad Malevich
how to fix errors?
Daniele
you are trying to use a function or a multi byte string with a function that accepts only unicode strings
Pavel
Look at your String class definition, maybe it have a conversion to char*
Daniele
would be correct?
I have no idea
Daniele
I don't really know C++ classes and such
Daniele
also, I don't know your code, I can only tell you what the compiler wants
Volad Malevich
very strange because same code has no errors on Borland C++ Builder 6.0, but it HAS on C++ Builder XE2
Anonymous
int main() { int input=0; std::vector<int>my_vector; // while (cin >> input) // my_vector.push_back(input); for(int i = 0 ; ;i++){ cin>>input; my_vector.push_back(input); } for(int i = 0 ; i<my_vector.size();i++){ std::cout<<my_vector[i]<<std::endl; } return 0; }
Anonymous
i want to take multiple inputs form the console , when i enters into next line i want to print input values
Anonymous
than what range i have to keep in for loop
RoshaN
Hello I'm a beginner in C++ , what is type casting ??
RoshaN
And how it's used in writing or reading in a binary file
Kartik nain
I am from commerce background and learning programming language starting with c.
01000001011011010100000101101110
.
?
Chernykh
Hello I'm a beginner in C++ , what is type casting ??
For example u have a ptr to char (1 byte)
Chernykh
Then if u want to get character value u can do it, but what if u want to get int or double. U can cast the ptr to another type
01000001011011010100000101101110
While ( scanf... != 0) Use something like this
Chernykh
Not c
Mat
Read the rulessssssssssss
Mo At least make your code readable
Anonymous
will it works while (cin >> input&&input!="\n")
01000001011011010100000101101110
We are using cpp
Yeah so? You can use scanf in cpp 😁
Chernykh
In cpp u can use stream with overloaded operators)) char ch; string std; while (cin >> ch) str += ch;
Chernykh
Not all c functions are secure to use in cpp
01000001011011010100000101101110
Bad practice
Yeah..but I think many people prefer scanf over cin
01000001011011010100000101101110
Yeah..but I think many people prefer scanf over cin
It returns the inputs as number.. moreover it is faster
Mat
??
Read 2 messages after yours
Chernykh
Yeah..but I think many people prefer scanf over cin
In this case I've just find out where the bad practice are born from
Mat
In cpp u can use stream with overloaded operators)) char ch; string std; while (cin >> ch) str += ch;
Mo Are you really following? He proposed the same answer as you without controlling the char. Just try it
Sidharth Kumar
Anyone having good knowledge in pc hardware?
01000001011011010100000101101110
And it's irrilevant
While loop needs a number.. which could be taking from scanf
Chernykh
While loop needs a number.. which could be taking from scanf
Under the hood it has about same mechanics
01000001011011010100000101101110
Mat
Oh alright😅
https://stackoverflow.com/questions/1042110/using-scanf-in-c-programs-is-faster-than-using-cin It's std::endl the real problem here. But it is a nice test
Chernykh
For all beginners: if u want to use c functions in cpp, or try to use it from std namespace or forget about it pls
Mat
🤔 Someone should test if those links are still valid with std::ios::sync_with_stdio(false);
Chernykh
Is there a text version?
Mat
Is there a text version?
https://stackoverflow.com/questions/213907/c-stdendl-vs-n First result on ddg
Chernykh
Thx
Anonymous
This is nice, we needed motivation