Advertisement
Aminpro

[ECP1016] In-Lab Assignment Trimester 2 2012 Number 3

Nov 28th, 2012
389
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.41 KB | None | 0 0
  1. // Feel free to optimize or correct the code at the Facebook page, your name will be added to the code ;)
  2. //https://www.facebook.com/AminproPastebin
  3.  
  4. #include <stdio.h>
  5.  
  6.  
  7. int main()
  8.  
  9. {
  10.     int user_choice1;
  11.     int user_choice2;
  12.    
  13.     printf("Choose Rock(0), Paper(1), or Scissors(2)");
  14.     printf("\nPlayer One's Choice: ");
  15.     scanf("%d", &user_choice1);
  16.     printf("\nPlayer Two's Choice: ");
  17.     scanf("%d", &user_choice2);
  18.      
  19.     {
  20.      
  21.     if ((user_choice1==0)&&(user_choice2==0))
  22.       {
  23.         printf("\nYou Tied!");
  24.       }
  25.     else if ((user_choice1==0)&&(user_choice2==1))
  26.       { printf("\nPlayer 2 Wins!");
  27.       }
  28.     else if ((user_choice1==0)&&(user_choice2==2))
  29.       { printf("\nPlayer 1 Wins!");
  30.       }
  31.     else if((user_choice1==1)&&(user_choice2==0))
  32.       { printf("\nPlayer 1 Wins!");
  33.       }
  34.     else if((user_choice1==1)&&(user_choice2==1))
  35.       { printf("\nYou tied!");
  36.       }
  37.     else if((user_choice1==1)&&(user_choice2==2))
  38.       { printf("\nPlayer 2 Wins!");
  39.       }
  40.     else if((user_choice1==2)&&(user_choice2==0))
  41.       { printf("\nPlayer 2 Wins!");
  42.       }
  43.     else if((user_choice1==2)&&(user_choice2==1))
  44.       { printf("\nPlayer 1 Wins!");
  45.       }
  46.     else if((user_choice1==2)&&(user_choice2==2))
  47.       { printf("\nYou Tied");
  48.       }
  49.     else
  50.       { printf("You have select an invalid selection.");
  51.        
  52.       }
  53.  
  54.    
  55.    }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement