Answer:
switch (object)
{
case Rock: cout << "Rock";
break;
case Paper: cout << "Paper";
break;
case Scissors: cout << "Scissors";
}
}
objectType winningObject(objectType plat1, objectTypeplay2)
(play2 == Rock && play1 == Paper))
return Paper;
else
return Scissors;
void gameResult(objectType play1, objectType play2, int&winner)
{
onjectType winnerOnject;
if (play1 == play2)
{
winner = 0;
cout<< "Both players selected ";
convertEnum(play1);
cout << ". This game is a tie." << endl;
}
else
{
winnerObject = winningObject(play1,play2);
//Output each player's choice
cout << "Player 1 selected ";
convertEnum(play1);
cout << " and player 2 selected ";
convertEnum(play2);
cout <<".";
//Decide the winner
if (play1 == winnerObject)
winner = 1;
else if (play2 == winnerObject)
winner = 2;
//Output the winner
cout << "Player " << winner << " wins thisgame." << endl;
}
}
void displayResults(int gCout, int wCountll, intwCount2)
{
cout << "The total number of plays: " << gCount<< endl;
cout << "The number of plays won by player 1: " <<wCountl << endl;
cout << "The number of plays won by player 2: " <<wCount2 << endl;
}