0

Please who can correct this code?

#include <iostream> using namespace std; int main() { int b; cout <<"enter a number\n"; cin <<b; cout <<"the number u entered are "<<b <<endl; return 0; }

17th Nov 2016, 9:51 PM
Umar Farouq (Humarh_dharnarh)
Umar Farouq (Humarh_dharnarh) - avatar
3 RĂ©ponses
+ 2
You should have cin >> b; // This reads from cin and writes to b and not cin << b; // This writes b to cin
17th Nov 2016, 9:55 PM
Arthur Busser
Arthur Busser - avatar
0
thanks
17th Nov 2016, 11:03 PM
Umar Farouq (Humarh_dharnarh)
Umar Farouq (Humarh_dharnarh) - avatar
0
cout << "The number you have entered is " << b << ".\n";
18th Nov 2016, 8:13 AM
YellowBunny