SHARE
TWEET

Untitled

a guest Aug 25th, 2019 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<stdio.h>
  2. #include<conio.h>
  3. void main()
  4. {
  5.     char player1[10],player2[10];
  6.     int in1,in2;
  7.     printf("HELLO, WELCOME TO ROCK, PAPER, SCISSORS GAME\nWhat is player1's name?\n ");
  8.     scanf("%s",&player1);
  9.     printf("What is player2's name?\n ");
  10.     scanf("%s",&player2);
  11.  
  12.     printf("%s and %s please follow the rules for the game\nPress 1 for stone\nPress 2 for paper\nPress 3 for scissors\n\n",player1,player2);
  13.     printf("Now let us start the game\n");
  14.  
  15.     printf("%s is it STONE 1, PAPER 2 OR SCISSORS 3\n",player1);
  16.     scanf("%d",&in1);
  17.     printf("%s is it STONE 1, PAPER 2 OR SCISSORS 3\n",player2);
  18.     scanf("%d",&in2);
  19.  
  20.     if ((in1==1 && in2==1) || (in1==2 && in2==2) || (in1==3 && in2==3))
  21.     printf("Neither %s nor %s won, it is a draw",player1,player1);
  22.  
  23.     else if ((in1==1 && in2==3) || (in1==3 && in2==2) || (in1==1 && in2==3)|| (in1==2 && in2==1) || (in1==3 && in2==2) || (in1==1 && in2==3))
  24.     printf("Congrats %s! You won!!!!",player1);
  25.  
  26.     else if ((in1==1 && in2==2) || (in1==3 && in2==1) || (in1==1 && in2==2)|| (in1==2 && in2==3))
  27.     printf("Congrats %s! You won!!!!",player2);
  28.    
  29. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top