0

Why I can only input once?

If the input value of a is not above 0, shouldn’t the user get to re-input another value for a? Is there something wrong with my while loop? https://code.sololearn.com/cbbUd794sDLc/?ref=app

10th Apr 2018, 3:00 PM
Jadenutt
Jadenutt - avatar
8 Réponses
+ 2
while (cin >> a && a <= 0) Did you try that?
10th Apr 2018, 4:03 PM
Timon Paßlick
+ 1
&& just checks the second boolean if the first boolean is false.
10th Apr 2018, 3:40 PM
Timon Paßlick
+ 1
Yes I have. It made no difference. I guess while(cin >>) only lets users to input once on this compiler. Such a bummer.
11th Apr 2018, 10:30 AM
Jadenutt
Jadenutt - avatar
+ 1
yes, you can only input once at the beginning on sololearn
11th Apr 2018, 11:17 AM
064XP
064XP - avatar
+ 1
Well, I think its intended haha. For testing small snippets of code, I use https://www.onlinegdb.com/online_c++_compiler and it works pretty great.
11th Apr 2018, 11:25 AM
064XP
064XP - avatar
+ 1
you're welcome! Good luck:)
11th Apr 2018, 11:28 AM
064XP
064XP - avatar
0
That’s a massive bug, cause this type of loops are quite frequently used.
11th Apr 2018, 11:21 AM
Jadenutt
Jadenutt - avatar
0
Wow, thank you! Seems useful.
11th Apr 2018, 11:27 AM
Jadenutt
Jadenutt - avatar