+ 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; }

24th Jul 2019, 10:13 AM
Hannah
Hannah - avatar
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.
24th Jul 2019, 7:06 PM
Manual
Manual - avatar
+ 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.
24th Jul 2019, 6:54 PM
Manual
Manual - avatar
+ 1
If you do not have an ide try visual studio. Mac/Windows https://visualstudio.microsoft.com/vs/
24th Jul 2019, 7:08 PM
Manual
Manual - avatar
0
You need to add the language to the tags like "input" "c++"
24th Jul 2019, 6:57 PM
Manual
Manual - avatar