+ 1
I want this program to cin as many times as the user wants , but it only cins 2 times, pls post the right form for me
#include <iostream> using namespace std; int main() { int a,b; char x; cin>>a>>b; cout<<a+b; cin>>x; if (x=='y'||x=='Y') { cin>>a>>b; cout<<a+b; } cin>>x; return 0; }
4 Answers
+ 1
Here is an example:
https://code.sololearn.com/c6bPbF7p87Da/?ref=app
You need a proper C++ Development environment for it to work.
+ 1
You need a loop to get the amount of input you want.
And something to end the loop.
side note: Such a code will not work on Sololearn. The for none web codes input is only requested once.
+ 1
If you do not have an ide try visual studio.
Mac/Windows
https://visualstudio.microsoft.com/vs/
0
You need to add the language to the tags like "input" "c++"