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

I am in c++ not Java I also have added my code I have so far. I need to make a r

ID: 3620790 • Letter: I

Question

I am in c++ not Java I also have added my code I have so far. I need to make a rock paper scissors game. I need a menu function, a directions function, which I have and is working fine. I just don't know how to write the game. I need it to store how many times the computer wins and player wins. The computers choice needs to be random. I don't know how to do this please help. I promise to rate #include <iostream>
using namespace std;

// Function Prototypes int directions (); int menu ();
int main() { directions (); menu ();


return 0; } //Directions int directions() { cout << "You are currently about to play a game of " << endl; cout << "Rock, Paper, Scissors against the computer" << endl; cout << endl; cout << "To play choose whether you want Rock, Paper," << endl; cout << "or scissors. The computer will randomly pick" << endl; cout << "an object as well. Rock beats scissors, Paper" << endl; cout << "covers rock, and scissors cut paper" << endl; cout << endl; cout << "***********************************************" <<endl; cout << endl; return 0; }

   //Menu int menu() {    int choice; cout << "Please choose which object you would like:" << endl; cout << "(1) Rock " << endl; cout << "(2) Paper " << endl; cout << "(3) Scissors " << endl; cout << "(4) Exit Game " << endl; cin >> choice; while (choice < 1 || choice > 4 ) // Validate input    {    cout << "Invalid Selection. Enter 1, 2, 3, or 4: ";    cin >> choice;    } return choice;
} I am in c++ not Java I also have added my code I have so far. I need to make a rock paper scissors game. I need a menu function, a directions function, which I have and is working fine. I just don't know how to write the game. I need it to store how many times the computer wins and player wins. The computers choice needs to be random. I don't know how to do this please help. I promise to rate #include <iostream>
using namespace std;

// Function Prototypes int directions (); int menu ();
int main() { directions (); menu ();


return 0; } //Directions int directions() { cout << "You are currently about to play a game of " << endl; cout << "Rock, Paper, Scissors against the computer" << endl; cout << endl; cout << "To play choose whether you want Rock, Paper," << endl; cout << "or scissors. The computer will randomly pick" << endl; cout << "an object as well. Rock beats scissors, Paper" << endl; cout << "covers rock, and scissors cut paper" << endl; cout << endl; cout << "***********************************************" <<endl; cout << endl; return 0; }

   //Menu int menu() {    int choice; cout << "Please choose which object you would like:" << endl; cout << "(1) Rock " << endl; cout << "(2) Paper " << endl; cout << "(3) Scissors " << endl; cout << "(4) Exit Game " << endl; cin >> choice; while (choice < 1 || choice > 4 ) // Validate input    {    cout << "Invalid Selection. Enter 1, 2, 3, or 4: ";    cin >> choice;    } return choice;
} #include <iostream>
using namespace std;

// Function Prototypes int directions (); int menu ();
int main() { directions (); menu ();


return 0; } //Directions int directions() { cout << "You are currently about to play a game of " << endl; cout << "Rock, Paper, Scissors against the computer" << endl; cout << endl; cout << "To play choose whether you want Rock, Paper," << endl; cout << "or scissors. The computer will randomly pick" << endl; cout << "an object as well. Rock beats scissors, Paper" << endl; cout << "covers rock, and scissors cut paper" << endl; cout << endl; cout << "***********************************************" <<endl; cout << endl; return 0; }

   //Menu int menu() {    int choice; cout << "Please choose which object you would like:" << endl; cout << "(1) Rock " << endl; cout << "(2) Paper " << endl; cout << "(3) Scissors " << endl; cout << "(4) Exit Game " << endl; cin >> choice; while (choice < 1 || choice > 4 ) // Validate input    {    cout << "Invalid Selection. Enter 1, 2, 3, or 4: ";    cin >> choice;    } return choice;
} #include <iostream>
using namespace std;

// Function Prototypes int directions (); int menu ();
int main() { directions (); menu ();


return 0; } //Directions int directions() { cout << "You are currently about to play a game of " << endl; cout << "Rock, Paper, Scissors against the computer" << endl; cout << endl; cout << "To play choose whether you want Rock, Paper," << endl; cout << "or scissors. The computer will randomly pick" << endl; cout << "an object as well. Rock beats scissors, Paper" << endl; cout << "covers rock, and scissors cut paper" << endl; cout << endl; cout << "***********************************************" <<endl; cout << endl; return 0; }

   //Menu int menu() {    int choice; cout << "Please choose which object you would like:" << endl; cout << "(1) Rock " << endl; cout << "(2) Paper " << endl; cout << "(3) Scissors " << endl; cout << "(4) Exit Game " << endl; cin >> choice; while (choice < 1 || choice > 4 ) // Validate input    {    cout << "Invalid Selection. Enter 1, 2, 3, or 4: ";    cin >> choice;    } return choice;
} #include <iostream>
using namespace std;

// Function Prototypes int directions (); int menu ();
int main() { directions (); menu ();


return 0; } //Directions int directions() { cout << "You are currently about to play a game of " << endl; cout << "Rock, Paper, Scissors against the computer" << endl; cout << endl; cout << "To play choose whether you want Rock, Paper," << endl; cout << "or scissors. The computer will randomly pick" << endl; cout << "an object as well. Rock beats scissors, Paper" << endl; cout << "covers rock, and scissors cut paper" << endl; cout << endl; cout << "***********************************************" <<endl; cout << endl; return 0; }

   //Menu int menu() {    int choice; cout << "Please choose which object you would like:" << endl; cout << "(1) Rock " << endl; cout << "(2) Paper " << endl; cout << "(3) Scissors " << endl; cout << "(4) Exit Game " << endl; cin >> choice; while (choice < 1 || choice > 4 ) // Validate input    {    cout << "Invalid Selection. Enter 1, 2, 3, or 4: ";    cin >> choice;    } return choice;
}

Explanation / Answer

please rate - thanks #include <iostream>
#include <string>
#include <cstdlib>
using namespace std;
int computer();
int user();
void score(int ,int);
void directions();
int main()
{

srand(time(0));
int usermove;
int computermove;
usermove=user();
while(usermove<3)
   { computermove=computer();
     score(usermove,computermove);
     usermove=user();
   
     }
return 0;
}
void directions()
{
cout << "You are currently about to play a game of " << endl;
cout << "Rock, Paper, Scissors against the computer" << endl;
cout << endl;
cout << "To play choose whether you want Rock, Paper," << endl;
cout << "or scissors. The computer will randomly pick" << endl;
cout << "an object as well. Rock beats scissors, Paper" << endl;
cout << "covers rock, and scissors cut paper" << endl;
cout << endl;
cout << "***********************************************" <<endl;
cout << endl;

}
    //Menu
int user()
{
int choice;
cout << "Please choose which object you would like:" << endl;
cout << "(1) Rock " << endl;
cout << "(2) Paper " << endl;
cout << "(3) Scissors " << endl;
cout << "(4) Exit Game " << endl;
cin >> choice;
while (choice < 1 || choice > 4 ) // Validate input
   {
      cout << "Invalid Selection. Enter 1, 2, 3, or 4: ";
      cin >> choice;
   }
return choice-1;
}
int computer()
{int move;
move=rand()%3;
if(move==0)
     cout<<"I chose rock ";
else if(move==1)
     cout<<"I chose paper ";
    else
       cout<<"I chose scissors ";  
return move;
}

void score(int user,int computer )
{
if(user==computer)
     cout<<"Tie! ";
else if(user==0&&computer==2)
     cout<<"You break my sissors. you win! ";
else if(user==0&&computer==1)
     cout<<"I cover your rock. you lose! ";
else if(user==1&&computer==2)
     cout<<"I cut your paper. you lose! ";
else if(user==1&&computer==0)
      cout<<"You cover my rock. you win! ";
else if(user==2&&computer==0)
      cout<<"I break your sissors, you lose! ";
else
       cout<<"You cut my paper. you win! ";
cout<<endl;
return;
}