C++ Variable Please help me | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

C++ Variable Please help me

#include <iostream> using namespace std; int main() { int a, b; int sum; cout << "43 32 \n"; cin >> a; cout << "12 34 \n"; cin >> b; sum = a + b; cout << "55 66: " << sum << endl; return 0; } I'm a little confused with this part , can someone please help me to check ? coding in sololearn "try it yourself ", after we've done the script and press it runs. it pop out something that asks for "split multiple inputs into separate lines" and i put( 55 space 66) is correct?

20th Apr 2017, 1:35 PM
John Goh (KH)
5 Answers
+ 3
You dont have to split your numbers as long as you put spaces then the input will be fine. Im a little confused on what you mean by correct? If your referring to the box that pops up then yes. This is how solo learn takes input. All input is required at the start of the program. If you were to put this in a different compiler you wouldn't get the pop up screen. The pop up is special to solo learn. Really what your code does is: 1. a blank cursor will first show indicating to enter a number. 2. Once you press enter your first cout line will show along with a new blinking cursor for the 2nd input. 3. Then the remaining cout line will display.
20th Apr 2017, 8:26 PM
Ty Ler
Ty Ler - avatar
+ 1
"split multiple inputs into separate lines" use enter key(new line). 55 66
20th Apr 2017, 1:42 PM
Eranga
Eranga - avatar
0
which means no any problem with my code right ? was it sort of creating a calculator formula ?
20th Apr 2017, 1:51 PM
John Goh (KH)
0
Yes program is doing what it asked(programmed) to do and u as a user need to provide what program asking from u to do. please note that SoloLearn has it's unique environment(Compiler/code editor) witch is very different from others.
20th Apr 2017, 2:03 PM
Eranga
Eranga - avatar
0
great , i love programming! thank you buddy, thanks for promptly replied my questions
20th Apr 2017, 2:07 PM
John Goh (KH)