#include <stdio.h>
#include <conio.h>
using namespace std;
int main(){
char p1, p2;
printf("PAPER ROCK SCISSORS GAME\n");
printf("Player 1: ");
scanf("%c", &p1);
fseek(stdin, 0, SEEK_END);
printf("Player 2: ");
scanf("%c", &p2);
switch(p1){
case 'P': switch(p2){
case 'P': printf("draw"); break;
case 'R': printf("Player 1 wins. Paper covers Rock\n"); break;
case 'S': printf("Player 2 wins. Scissors cut Paper\n"); break;
default: break;
} break;
case 'R': switch(p2){
case 'R': printf("draw"); break;
case 'S': printf("Player 1 wins. Rock breaks Scissors\n"); break;
case 'P': printf("Player 2 wins. Paper covers Rock\n"); break;
default: break;
} break;
case 'S': switch(p2){
case 'S': printf("draw"); break;
case 'P': printf("Player 1 wins. Scissors cut Paper\n"); break;
case 'R': printf("Player 2 wins. Rock breaks Scissors\n"); break;
default: break;
} break;
default: break;
}
return 0;
}
Comments
Leave a comment