Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

and this is my code #include #include using namespace std; void singleplayer(int choose); void multiplayer(int p1, int p2); int computer, n, player1, player2; char response,

image text in transcribedimage text in transcribed

and this is my code

#include

#include

using namespace std;

void singleplayer(int choose);

void multiplayer(int p1, int p2);

int computer, n, player1, player2;

char response, game;

int main()

{

while (response = 'Y' || response == 'y')

{

cout

cin >> game;

if (game == 's' || game == 'S')

{

cout

cin >> player1;

singleplayer(player1);

cout

fflush(stdin);

cin >> response;

}

if (game == 'm' || game == 'M')

{

cout

cin >> player1;

cout

cin >> player2;

multiplayer(player1, player2);

cout

fflush(stdin);

cin >> response;

}

}

return 0;

}

void singleplayer(int choose)

{

while (1){

computer = rand() % 3 + 1;

if (choose == 1 && computer == 3)

{

cout

break;

}

else if (choose == 1 && computer == 2)

{

cout

break;

}

else if (choose == 1 && computer == 1)

{

cout

}

else if (choose == 2 && computer == 1)

{

cout

break;

}

else if (choose == 2 && computer == 3)

{

cout

break;

}

else if (choose == 2 && computer == 2)

{

cout

}

else if (choose == 3 && computer == 1)

{

cout

break;

}

else if (choose == 3 && computer == 2)

{

cout

break;

}

else if (choose == 3 && computer == 3)

{

cout

}

else{

break;

}

while (choose == computer)

{

cout

cin >> choose;

}

}

}

void multiplayer(int p1, int p2)

{

while (1){

if (p1 == 1 && p2 == 3)

{

cout

break;

}

else if (p1 == 1 && p2 == 2)

{

cout

break;

}

else if (p1 == 1 && p2 == 1)

{

cout

}

else if (p1 == 2 && p2 == 1)

{

cout

break;

}

else if (p1 == 2 && p2 == 3)

{

cout

break;

}

else if (p1 == 2 && p2 == 2)

{

cout

}

else if (p1 == 3 && p2 == 1)

{

cout

break;

}

else if (p1 == 3 && p2 == 2)

{

cout

break;

}

else if (p1 == 3 && p2 == 3)

{

cout

}

else{

break;

}

while (p1 == p2)

{

cout

cout

cin >> p1;

cout

cin >> p2;

}

}

}

Based on your solution to 6.24, implement (using functions) the Rock Paper Scissors Spock Lizard game. (as popularized on "The Big Bang Theory" TV show) functions) the Rock Paper Scisors Sposk

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Expert Oracle Database Architecture

Authors: Thomas Kyte, Darl Kuhn

3rd Edition

1430262990, 9781430262992

Students also viewed these Databases questions

Question

=+4 Develop and deliver the CCT program.

Answered: 1 week ago