0
Whats wrong with my code?
#include <iostream> using namespace std; int main() { int a,b; cin<<"Enter the numbers"; cout<<a+b; return 0; }
5 Réponses
+ 3
cin is for input, not output
+ 3
cin is an object of iostream and used to flow data between standard input(keyboard) and standard output (monitor ) so u could only user cin for standard input such as input of int,char float single Variable (char array not included for input of cin) so your code should be like this ...
int main()
{
int a,b;
cout<<"enter the number 1"<<endl;
cin>>a;
cout<<"enter the number 2"<<endl;
cin>>b;
cout<<a+b;
return 0;
}
and remember you cannot use quotation ("") symbol in cin
...it is so basics of c++ or any other languages..... hope it will help you ....
+ 1
in and out vice versa, so >> and << vice versa.
0
yea,I asked the user for the input ..then printed to add it ...then why?
0
thank u bro