0

while loop cpp

Why does this code not work? What means the output? Thanks for every answer! #include <iostream> using namespace std; int main() { int x; int i = 1; while (i < 5) { cin >> x; cout << x+x; i++; } } Output after entering a number (for example 1) : bash: 1: command not found

29th Jul 2021, 7:01 AM
Falling Never
Falling Never - avatar
3 Answers
+ 2
It works fine. Just like JaS said in sololearn you have to give all inputs at start. For example: when SL asks for input enter something like 1 2 3 4 And it should work fine.
29th Jul 2021, 7:22 AM
Alaska
Alaska - avatar
+ 2
This code works fine. Only in SL Playground you have to put all data input at its start.
29th Jul 2021, 7:16 AM
JaScript
JaScript - avatar
+ 1
It works for me.
29th Jul 2021, 7:14 AM
Paul
Paul - avatar