In C language please sample output is given and so is an out

In C language please!!!!! sample output is given and so is an outline of program.

Write an interactive program to play the game of \"Rock Paper Scissors\" with the computer as your opponent. Your program will prompt the user for input, generate a random input for the opponent, calculate and display who won. The program will run in a loop continually until Esc is pressed.

Sample Output :

Welcome to Rock Paper Scissors

May the best sentient being win.

Enter R, P, or S. Press ESC to end the game.

Human Puter Winner

--------------------------

Rock Rock Draw

Paper Rock Human

Scissor Rock Puter

Press any key to continue . . .

Psuedocode:

// This is a mix of psuedocode and actual C code
#include \"stdio.h\"
#include \"conio.h\"
#include \"stdlib.h\" // rand is in here
#include \"time.h\" // contains time structure
#pragma warning (disable : 4996) // turn off stdio function warnings
time_t t; // a time object for rand seed
// seed random number generator
srand((unsigned)time(&t));
// MAIN PROCESSION LOOP
do {
   // Get human\'s move
   // character input validation loop
   do {
       get ch1
           switch on ch1
       {
           case \'R\'
           case \'r\'
           case \'P\'
           case \'p\'
           case \'S\'
           case \'s\'
           case 27
           chOK = 1
           break
           default
           chOK = 0
       }
       Page 2 of 7
   } while chOK is true
   // Convert input to uppercase
   // this is actual C code, please tell me why this line works
   if (ch1 > \'Z\') ch1 -= \' \';

               // Get computer\'s move
               ch2 = rand() % 3; // C code to get a rand #
               switch on ch2
               {
                   case 0
                   ch2 = R
                   break
                   //etc...
               }
               // Check who won
               if (ch1 and ch2 are both R)
                   print \"Rock Rock Draw\"
                   if (ch1 is an R and ch2 is a P)
                       print \"Rock Paper Puter\"
                       //etc... there are 9 total possible combinations
} while ch1 is not ESC

Solution

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <stdlib.h>
int main(void)
{
    srand(time(NULL)); // seed random number generator
    char ch1; // human choice
    int ch = 0;
    printf(\"Welcome to Rock Paper Scissors.\ May the best sentient being win.Enter R, P, or S. \ Press ESC to end the game.\ \");
    printf(\"Human Puter Winner\ ......................\ \");
    scanf(\"%c\",&ch1); //Get human\'s move
    do
    {
        // character input validation and converting that input to integer
        switch(ch1)
        {
            case \'R\':
            case \'r\': ch = 1; break;
          
            case \'P\':
            case \'p\': ch = 2; break;
          
            case \'S\':
            case \'s\': ch = 3; break;
          
            case 27: ch = 27; break;
            default: ch = 28; break;
        }
      
        int ch2 = (rand() % 3) + 1; // Get computer\'s move
        // Checking who won
        if(ch == 1)
        {
            if(ch2 == 1)
                printf(\"Rock Rock Draw\ \");
          
            else if(ch2 == 2)
                printf(\"Rock Paper Puter\ \");
          
            else if(ch2 == 3)
                printf(\"Rock Scissor Human\ \");
        }
        else if(ch == 2)
        {
            if(ch2 == 1)
                printf(\"Paper Rock Human\ \");
          
            else if(ch2 == 2)
                printf(\"Paper Paper Draw\ \");
          
            else if(ch2 == 3)
                printf(\"Paper Scissor Puter\ \");
        }
        else if(ch == 3)
        {
            if(ch2 == 1)
                printf(\"Scissor Rock Puter\ \");
          
            else if(ch2 == 2)
                printf(\"Scissor Paper Human\ \");
          
            else if(ch2 == 3)
                printf(\"Scissor Scissor Draw\ \");
        }
        else if(ch == 28)
        {
            printf(\"Press any key to continue . . . \ \");
        }
        else if(ch == 27)
        {
            ch1 = 27;
        }
      
        scanf(\"%c\",&ch1);
      
    }
    while(ch1 != 27);
}

In C language please!!!!! sample output is given and so is an outline of program. Write an interactive program to play the game of \
In C language please!!!!! sample output is given and so is an outline of program. Write an interactive program to play the game of \
In C language please!!!!! sample output is given and so is an outline of program. Write an interactive program to play the game of \

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site