Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Start:
- string choice, pcChoice;
- int randomInt;
- Console.WriteLine("Rock / Paper / Scissors");
- choice = Console.ReadLine();
- random rnd = new random();
- randomInt = rnd.Next(1,4);
- switch (randomInt)
- {
- case 1:
- pcChoice = "rock";
- break;
- case 2:
- pcChoice = "paper";
- break;
- case 3:
- pcChoice = "scissors";
- break;
- default:
- Console.WriteLine("invalid input, try again");
- goto Start;
- break;
- }
- if (choice == pcChoise)
- {
- Console.WriteLine("Draw");
- }
- if (choice == "rock")
- {
- if (pcChoise == "paper")
- {
- Console.WriteLine("Computer win");
- }
- if (pcChoise == "scissors")
- {
- Console.WriteLine("You win");
- }
- }
- if (choise == "paper")
- {
- if (pcChoise == "rock")
- {
- Console.WriteLine("You win");
- }
- if (pcChoise == "scissors")
- {
- Console.WriteLine("Computer win");
- }
- }
- if (choice == "scissors")
- {
- if (pcChoice == "rock")
- {
- Console.WriteLine("Computer win");
- }
- if (pcChoice == "paper")
- {
- Console.WriteLine("You win");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement