0

Why I cant give value to cin >> b

int a, b; cout << "Enter a number \n"; cin >> a; cout << "Enter another number \n"; cin >> b; cout << a << " - "<< b; when you give number you give it for a but not for b. b cout 8 why

18th Oct 2018, 6:49 PM
Arsen
7 Antworten
+ 9
What compiler are you using?
19th Oct 2018, 1:53 PM
blACk sh4d0w
blACk sh4d0w - avatar
+ 7
I don't see any error in the code. Can you elaborate more what's the issue you are facing?
18th Oct 2018, 7:02 PM
blACk sh4d0w
blACk sh4d0w - avatar
0
try to type in user input: 9 8 ^ ------------------------------------------------------ | else try this, rewrite in the user input | ---------------------------------------------------------| #include<iostream> using namespace std; int main() { int a, b; cout << "Enter a number \n"; cin >> a >> b; cout << "Enter another number \n"; cout << a << " - "<< b; }
18th Oct 2018, 7:02 PM
Alihuseyn Kengerli
Alihuseyn Kengerli - avatar
0
What you input to this program? (specify exact form)
18th Oct 2018, 7:03 PM
KrOW
KrOW - avatar
0
input to program so 9 7
18th Oct 2018, 7:04 PM
Alihuseyn Kengerli
Alihuseyn Kengerli - avatar
0
you need to type with newline 9 7
18th Oct 2018, 7:07 PM
Alihuseyn Kengerli
Alihuseyn Kengerli - avatar
0
when you say program to run this code he offers you to give value a but only for a not for b. you give a any value but for b it give 8. Why
19th Oct 2018, 11:38 AM
Arsen