1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
#include <stdio.h>
void displayRules();
void userInput (char p1, char p2);
int main()
{
char p1Choice, p2Choice, decison;
int count = 0;
displayRules();
do{
userInput (p1Choice, p2Choice);
printf("Go Again ?\n");
scanf("%c", &decison);
}while(decison == 'y' || decison == 'Y');
}
}
void displayRules()
{
printf("Welcome to the game of Rock, Paper, Scissors.\n\n");
printf("This is a game for two players. For each game, \n");
printf("each player selects one of the objects, Rock, Paper, or Scissors.\n\n");
printf("The rules for winning the game are: \n\n");
printf("1. If both players select the same object, it is a tie.\n\n");
printf("2. Rock beats Scissors. \n\n");
printf("3. Paper beats Rock. \n\n");
printf("4. Scissors beats Paper.\n\n");
printf("Enter R to select Rock, P to select Paper, and S to select Scissors.\n\n");
}
void userInput (char p1, char p2)
{
printf("Player 1 Enter Your Choice\n");
scanf("%c", &p1);
getchar();
printf("Player 2 Enter Your Choice\n");
scanf("%c", &p2);
getchar();
}
|