0

Why every next number executes in a new line?

#include <iostream> using namespace std; int main() { int num = 1; int number; while (num <= 5) { cin >> number; num++; } return 0; }

29th Nov 2018, 12:03 PM
Ilkin
Ilkin - avatar
5 Answers
+ 2
Yes, you can add this line cout << number << " "; after your cin line
29th Nov 2018, 12:58 PM
Matthias
Matthias - avatar
+ 1
What do you mean by that? In Sololearn you have to give the input in advance and they are separated by new lines or spaces. 1 2 3 4 5
29th Nov 2018, 12:46 PM
Matthias
Matthias - avatar
+ 1
What do you mean by that? In Sololearn you have to give the input in advance and they are separated by new lines or spaces. 1 2 3 4 5
29th Nov 2018, 12:47 PM
Matthias
Matthias - avatar
0
is it possible to make numbers to execute in a same line. Like 1 2 3 4 5?
29th Nov 2018, 12:53 PM
Ilkin
Ilkin - avatar
0
thanks
29th Nov 2018, 1:01 PM
Ilkin
Ilkin - avatar