+ 1

Why does the cin not work?

#include <iostream> using namespace std; int main() { cout << "Hello" << endl; int a; cout <<"Enter value A"<<endl; cin>>a; int b; cout <<"Enter Value B"<<endl; cin>>b; return 0; } The first user input works But the second just dosent work, can you guys tell me why?

20th Jul 2017, 2:57 PM
Kevin Paresh
6 Answers
+ 7
Read the message in the prompt when you run the code. The part about multiple inputs
20th Jul 2017, 3:06 PM
Manual
Manual - avatar
+ 4
enter the next comment exactly as you see it. format for multiple inputs Line 1: 12 space Line 2: 45 next comment for input example you get one chance for inputing all your values in sololearn exept for javascript
20th Jul 2017, 3:08 PM
Manual
Manual - avatar
+ 4
12 45
20th Jul 2017, 3:08 PM
Manual
Manual - avatar
0
Remember if you're using the "CODE PLAYGROUND" you need to input both values at the same time, with an enter to seperate: 5 7 Just tested it with no errors.
20th Jul 2017, 3:08 PM
Frederik Stenberg
Frederik Stenberg - avatar
0
int b declared 1st line in main
20th Jul 2017, 3:12 PM
ch.chitti srilakshmi
ch.chitti srilakshmi - avatar
0
I use code Blocks to execute the code so it does not let me put more than one input.can you help me with it?
20th Jul 2017, 5:25 PM
Kevin Paresh