i was wondering if their were some way that when the program run i would be able to see the number inputed along with the sign. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

i was wondering if their were some way that when the program run i would be able to see the number inputed along with the sign.

I just started programing and don't really know a lot I have a problem I can't seem to figure out in C++ I want to make the number or figure a person input visible it kinda hard to explain but for example. int a; int b; cin >> a cin >> b int add ; add = a + b; cout << add;

20th Dec 2017, 11:20 PM
Çrimsøn Røsē
Çrimsøn Røsē - avatar
5 Answers
+ 4
If you're writing this in Code Playground it is not possible, given the way Code Playground works, all the necessary input along with the code are sent to the server to be processed, and we will only see the output. If you want to have interactive session you would need to have an IDE or at least a compiler, and run the code in your development machine. This code added a little verbosity to your code by displaying its input after the prompt for it, but still, it's not interactive if ran in Code Playground. #include <iostream> using namespace std; int main() { int a, b; cout << "Enter the first number: "; cin >> a; cout << a << endl; cout << "Enter the second number: "; cin >> b; cout << b << endl; int add = a + b; cout << "Result from "<< a << " + " << b << " = " << add; return 0; } Hth, cmiiw
21st Dec 2017, 1:07 AM
Ipang
+ 2
do you want it to tell the number after they enter it for that just add cout<<a<<endl; and b after them or if you want the last output you can put cout<<a<<" + "<<b<<" = "<<c; that will display If you input 5 and 6 will display 5 + 6 = 11. hope this is what you wanted.
21st Dec 2017, 1:08 AM
Mooaholic
Mooaholic - avatar
+ 2
thanks they were helpful
21st Dec 2017, 1:15 AM
Çrimsøn Røsē
Çrimsøn Røsē - avatar
+ 2
You're welcome, glad to help : )
21st Dec 2017, 1:18 AM
Ipang
0
do you mined checking the codes for me
21st Dec 2017, 2:17 AM
Çrimsøn Røsē
Çrimsøn Røsē - avatar