+ 1
what it's problem ?
I want it to add 1 to g if the input was w , and add 1 to f if the input was r , until one of them (f or g) reach 3 , and then show the winner ! #include <iostream> using namespace std; int main(){ int g=0,f=0; char c; cin>>c; switch(c){ case 'w': g++; break; case 'r': f++; break; if (g>=3||f>=3) cout<<g; cout<<f; break; } return 0;
10 Answers
+ 2
https://code.sololearn.com/c3E7U4H8osFT/?ref=app here is the problem solved with both things
edit: cool
Now it works properly, I had to redefine "c" at the start of every loop
+ 2
now i understand , thanks for being patient enough to help me !
+ 1
You have to insert everything into a while loop
+ 1
i dont understand ... Would you post the right form for me ?
+ 1
First of all the program ends when the user insert the input once, the other problem is that you have to make one if statement when g wins and another one when f wins, if you put both in one if statement both will show up
+ 1
so could you post the corrected form here if possible ?
+ 1
but thats not correct dear Alvaro 1234 !
+ 1
Sorry, I didn't read the thing properly, it should be good now
+ 1
not correct even now dear ... what are these : >:
>:
>:
+ 1
It's a small decoration for when the user has to insert input, the thing is that if you don't input anything the program will print that forever, and in solo learn console you have to input the options in one go, it would be better if you could compile it and run it in a native console