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
8 Réponses
+ 2
while (cin >> a && a <= 0)
Did you try that?
+ 1
&& just checks the second boolean if the first boolean is false.
+ 1
Yes I have. It made no difference. I guess while(cin >>) only lets users to input once on this compiler. Such a bummer.
+ 1
yes, you can only input once at the beginning on sololearn
+ 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.
+ 1
you're welcome! Good luck:)
0
That’s a massive bug, cause this type of loops are quite frequently used.
0
Wow, thank you! Seems useful.