+ 3

why doesn't the program ask for input twice ?

#include <iostream> using namespace std; int main() { int a, b; int sum; cout << "Enter a number \n"; cin >> a; cout << "Enter another number \n"; cin >> b; sum = a + b; cout << "Sum is: " << sum << endl; return 0; } it just ask the users once and if you enter just one number you will run into an error

24th Jul 2020, 1:36 PM
Atena
Atena - avatar
4 Answers
+ 4
Please check your code again. It's asking for input.. Sometimes this happens when network connection is slow.. It also shows no output once network issue occurs. Answer to edited question: It will not ask for twice input. You have to use new lines in that for multiple input
24th Jul 2020, 1:39 PM
Arctic Fox
Arctic Fox - avatar
+ 2
Check this code for SoloLearn playground input behaviour.. it shows how to input to console in Sololearn. Hope it helps you understand SoloLearn console behaviour.. https://code.sololearn.com/WhiNb9BkJUVC/?ref=app
24th Jul 2020, 2:10 PM
Jayakrishna 🇼🇳
0
When you enter the first number then you have press enter to enter the 2nd number.
24th Jul 2020, 1:52 PM
shubham kumar
shubham kumar - avatar