Loop In game of Rock, Paper, Scissors in C++ -
i'm doing game of rock paper scissors i'm not sure have loop correct let alone rest of code. continue expected ')' @ end of input , expected '(' @ end of input , ';' @ end of input , expected '}' @ end of input. teachers aren't if few pointers on how that'd great, thank you. heres have.
#include <iostream> #include <string> using namespace std; int main() { char choice = 'n'; { { char playerone; char playertwo; cout << "player 1: enter r rock, p paper, or s scissors:" << e$ cin >> playerone; cout << "player 2: enter r rock, p paper, or s scissors:" << e$ cin >> playertwo; switch (playerone) { case 'r': case 'r': switch (playertwo) { case 'r': case 'r': cout << "tie" << endl; break; case 'p': case 'p': cout << "player 2 wins" << endl; break; case 's': case 's': cout << "player 1 wins" << endl; break; } break; case 'p': case 'p': switch (playertwo) { case 'p': case 'p': cout << "tie" << endl; break; case 'r': case 'r': cout << "player 1 wins" << endl; case 's': case 's': cout << "player 2 wins" << endl; break; } break; case 's': case 's': switch (playertwo) { case 's': case 's': cout << "tie" << endl; break; case 'p': case'p': cout << "player 1 wins" << endl; case 'r': case 'r': cout << "player 2 wins" << endl; break; } cout << "do want play again, press y yes or press n no"; cin >> choice; } while ((choice == 'y' || choice == 'y')); } return 0; }
Comments
Post a Comment