0

Mistake in this program

#include <iostream> using namespace std; int main() { int a; int 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; }

4th Dec 2016, 4:36 AM
Jarvis
Jarvis - avatar
7 odpowiedzi
+ 4
Code Playground on sololearn disables getting more than one input. Try this on an IDE and it will work fine.
4th Dec 2016, 5:41 AM
Wen Qin
Wen Qin - avatar
+ 2
"PlayGround Code" Makes you to separe your imputs with spaces, and imput them all together once. In a console that would be diferent. Try putting 1 2 and it will works.
4th Dec 2016, 4:51 AM
Nahuel
Nahuel - avatar
0
I don't see anything wrong
4th Dec 2016, 4:41 AM
Aniket Bhattacharyea
Aniket Bhattacharyea - avatar
0
just once run it
4th Dec 2016, 4:42 AM
Jarvis
Jarvis - avatar
0
you have to enter both the number at the same time in two lines. the code playground cannot accept inputs more than once
4th Dec 2016, 4:44 AM
Aniket Bhattacharyea
Aniket Bhattacharyea - avatar
0
can we put the sum and also the same line
4th Dec 2016, 4:46 AM
Jarvis
Jarvis - avatar
0
means int (a, b, sum);
4th Dec 2016, 4:47 AM
Jarvis
Jarvis - avatar