Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Name this program rpsls. c - The game of rock-paper-scissors was expanded so tha

ID: 3796208 • Letter: N

Question

Name this program rpsls. c - The game of rock-paper-scissors was expanded so that it now includes rock-paper-scissors-lizard-spock. The expansion was created by Sam Kass and Karen Bryla and made famous on the Big Bang Theory. This program builds on the rock-paper-scissors program you wrote earlier. It still does the same basic processing that you did earlier. Assume that 0 = rock, 1 = paper, 2 = scissors, 3 = lizard, and 4 = spock. The main program is shown below, int main() {srand(0); int a, games, p1, p2, ans, ties = 0, p1wins=0, p2wins=0; games = numGames(); for (a=0; a

Explanation / Answer

int numGames()
{
   cout<<"Enter number of games to play:";//prompting
   int n;
   cin>>n;//reading integer
   return n;//returning
  
}
int winner(int p1,int p2)
{
   if(p1==p2)return 0;//if tie
   if(p1>p2)return 1;//if p1 wins
   return 2;//if p2 wins
  
}
void printResults(int a,int b,int c,int d)
{
   cout<<"Total number of games:"<<a<<" ";
   cout<<"Number of ties:"<<b<<" ";
   cout<<"Player 1 wins:"<<c<<" ";
   cout<<"Player 2 wins:"<<d<<" ";
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote