0

2 CIN functions

Help!i just started learning c++ and i can't figure out why the two input function does not work. example: #include <iostream> using namespace std; int main() { int a, b; cout << "Enter a number \n"; cin >> a; cout << "Enter another number \n"; cin >> b; cout << a << " "<< b; return 0; } when i put one value which is for a, the system automatically runs b=8 no matter what! anyone can explain??????

19th Jul 2018, 4:10 PM
Wan Faiz
1 Odpowiedź
+ 2
In Sololearn you have to put every input in advance. This is a bit annoying, I know... :/ So you have to input 1 2 For each variable a new line or also space 1 2 Then it will show 1 2 in the output.
19th Jul 2018, 4:14 PM
Matthias
Matthias - avatar