+ 1
Why this message displays when I do run for program that include (cin >>)?
This is a message: Looks like your program needs input split multiple inputs into separate lines https://code.sololearn.com/cYSmiwHgeyyq/?ref=app https://code.sololearn.com/cYSmiwHgeyyq/?ref=app
4 ответов
+ 2
cin takes user input. All inputs on sololearn (except web) are displayed this way. Because input is poorly made here, it takes all inputs at once. So, if you have:
int x, y;
cin >> x >> y;
And if you input:
3
6
x will have the value 3, and y will have the value 6.
+ 1
It does that to keep things organized. Let's say you have two variables: x and y. If you want to have those variables store an input, they need to be on separate lines.
For example:
If you input
12
on one line, the value of 'x' will be 12 and 'y' will not not have a stored value.
But if you input
1
2
the value of 'x' will be 1, and the value of 'y' will be 2.
+ 1
Limitations of Sololearn platform.
0
When you use cin >> you're requesting something to the user of your program.
For my experience, SoloLearn only lets you ask for input once in the program.
So, if you want to run properly the program you post here, it must be executed in a computer.