Need help with this C programming assignment Rock Paper Sc

Need help with this C# programming assignment:

Rock - Paper - Scissors

Re-familiarize yourself with how to play Rock, Paper, Scissors. You will be writing the code to implement a game “judge,” taking information on two players’ selections and displaying the game result.

Functionality:

Prompt the user to enter the first player\'s choice.

Then ask for the second player\'s selection.

Finally, display who the winner is and the appropriate statement \" .\"

Example: \"Rock smashes Scissor. Player 1 wins.\" Only use the programming constructs we have learned thus far. Don\'t skip ahead and use other language forms to simplify the program. This will likely be an example of a difficult to follow implementation. The code won’t look nice. Do your best with comments and formatting, to make clear what the program is doing.

Assumptions:

No invalid user inputs, other than a blank entry, will be checked. Assume the user only enters valid entries.

If user input is empty, then exit the program after displaying an error message.

If you use text input, you don\'t need to worry about checking capitalization of the user input. Assume all letters will be lowercase. Likewise, assume all inputs are always spelled correctly.

Solution

#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <string>

using namespace std;

int main()
{
   do{


       string user1Choice;

       string user2Choice;

       cout << \"Rock, paper, or scissors? (All lowecase) i.e rock, paper, scissors\" << endl;
       cout << \" \" << endl;
cout << \"Enter user1 Choice:\";
       cin >> user1Choice;
cout << \"Enter user2 Choice:\";
cin >> user2Choice;

       //Determines winner
       //Rock
       if (user1Choice == \"rock\" && user2Choice == \"rock\")
       {

           cout << \"It\'s a tie!\" << endl;
           cout << \" \" << endl;

       }
       else if (user1Choice == \"rock\" && user2Choice == \"paper\")
       {

           cout << \"user2 wins!\" << endl;
           cout << \" \" << endl;

       }
       else if (user1Choice == \"rock\" && user2Choice == \"scissors\")
       {

           cout << \"user1 wins!\" << endl;
           cout << \" \" << endl;

       }
       //Paper
       if (user1Choice == \"paper\" && user2Choice == \"rock\")
       {

           cout << \"user1 wins!\" << endl;
           cout << \" \" << endl;

       }
       else if (user1Choice == \"paper\" && user2Choice == \"paper\")
       {

           cout << \"It\'s a tie!\" << endl;
           cout << \" \" << endl;

       }
       else if (user1Choice == \"paper\" && user2Choice == \"scissors\")
       {

           cout << \"user2 wins!\" << endl;
           cout << \" \" << endl;

       }
       //Scissors
       if (user1Choice == \"scissors\" && user2Choice == \"rock\")
       {

           cout << \"user2 wins!\" << endl;
           cout << \" \" << endl;

       }
       else if (user1Choice == \"scissors\" && user2Choice == \"paper\")
       {

           cout << \"user1 wins!\" << endl;
           cout << \" \" << endl;

       }
       else if (user1Choice == \"scissors\" && user2Choice == \"scissors\")
       {

           cout << \"It\'s a tie!\" << endl;
           cout << \" \" << endl;

       }
   } while (cin.get());

   cin.get();
   return 0;
}

Need help with this C# programming assignment: Rock - Paper - Scissors Re-familiarize yourself with how to play Rock, Paper, Scissors. You will be writing the c
Need help with this C# programming assignment: Rock - Paper - Scissors Re-familiarize yourself with how to play Rock, Paper, Scissors. You will be writing the c

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site