Working with variables C++ "Visual Studio Community Problem" | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Working with variables C++ "Visual Studio Community Problem"

int a, b; int sum; cout << "25 36 \n"; cin >> a; cout << " 31 54 \n"; cin >> b; sum = a + b; cout << "56 90: " << sum << endl; with above code , i debugged it in Visual Studio Community 2017 , when the window pop up, it wont appear " Press any key to continue" at the bottom , just blank and black . but in SoloLearn it does , it would appear "Seems like your program requires input" & "Split multiple inputs into separate lines" any problem with my code ??I need some help with some explaination.

21st Apr 2017, 2:50 AM
John Goh (KH)
4 Answers
+ 10
There is no problem with your code. I don't know about Visual Studio Community but I know that here in sololearn, that is the way input is handled. You have to insert all you input in the begining, before the code runs. And you input is not displayed in the console. And more, like the popup says if you have more than one input put them in separated lines.
21st Apr 2017, 3:15 AM
Ulisses Cruz
Ulisses Cruz - avatar
+ 1
can you show me some example so that i could work out of my own.
21st Apr 2017, 3:34 AM
John Goh (KH)
+ 1
@luka below is my code int male, female; int sum; cin >> male; cout << " 11 21 \n"; cin >> female; cout << " 21 32 \n"; sum = male + female; cout << " 32 53: " << sum << endl; return 0; the result is still remining...nothing change, "Press any key to continue" is gone,
21st Apr 2017, 4:44 AM
John Goh (KH)
0
#include <iostream> using namespace std; int main () { int male, female; int sum; cin >> male; cout << " 11 21 \n"; cin >> female; cout << " 21 32 \n"; sum = male + female; cout << " 32 53: " << sum << endl; return 0; } LoL ...I'm apologised
21st Apr 2017, 5:04 AM
John Goh (KH)