0
Cin
int time, rime; cin >> time >> rime; Input is 9: 8 Why doesnt rime take 8 as input?
6 ответов
+ 4
You have to take Input in seperate line on Sololearn Playground.
like this
9
8
+ 3
If you try to read in something that doesn't work - like a char into an int - the cin object is set to 'fail'.
In that case you first have to use the cin.clear() method to reset it to normal.
+ 2
Seems, cin is made to detect mistakes instead of ignoring them, but I don't know the details myself.
I'd recommend (also to myself) to google cin and study it thoroughly.
+ 1
A J
No u got it wrong
Input is not 9 8 or
9
8
Input is 9: 8
Or
9:
8
+ 1
Zohal I think it's happening because of 9: . If we take input as 9 then it's taking 8 as input otherwise 0 is coming.
Let's see the reply of people who know c++ well.
0
HonFu
If I read a char into an int, shouldnt it save the Ascii code instead?