include <iostream>
using namespace std;
int main ()
{
char one, two, p, s, r, P, R, S, ans, y, Y;
do
{
cout << "Do you want to play a Rock, Paper or Scissors Game?\n";
cin >> ans;
if ((ans == 'y')|| (ans == 'Y'))
{
cout << "Player 1 choose R, P or S.\n";
cin >> one;
cout << "Player 2 choose R, P or S.\n";
cin >> two;
if ((one == 'p' || one == 'P') & (two == 's' || two == 'S'))
cout << "Player 2 wins Scissor cuts paper" << endl;
else if ((one == 'p' || one == 'P') & (two == 'r' || two == 'R'))
cout << "Player 1 wins Paper covers Rock" << endl;
else if ((one == 's' || one == 'S') & (two == 'r' || two == 'R'))
cout << "Player 2 wins Rock destroys scissors" << endl;
else if ((one == 's' || one == 'S') & (two == 'p' || two == 'P'))
cout << "Player 1 wins Scissors cut Paper" << endl;
else if ((one == 'r' || one == 'R') & (two == 's' || two == 'S'))
cout << "Player 1 wins Rock destroys Scissors" << endl;
else if ((one == 'r' || one == 'R') & (two == 'p' || two == 'P'))
cout << "Player 2 wins Paper covers Rock" << endl;
else if ((one == 's' || one == 'S') & (two == 's' || two == 'S'))
cout << "Tie" << endl;
else if ((one == 'p' || one == 'P') & (two == 'p' || two == 'P'))
cout << "Tie" << endl;
else if ((one == 'r' || one == 'R') & (two == 'r' || two == 'R'))
cout << "Tie" << endl;
else
cout << "you're too stupid to play this game" << endl;
}
else
cout << "Goodbye\n";
}while (one !=0);
return 0;
}
After i run this program i get it to say goodbye when i dont want to play rock paper or scissors but i can get the program to end, it just asks if i want to play another game
Tags: