Advertisement
Guest User

sample

a guest
Feb 25th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.92 KB | None | 0 0
  1. public class Program
  2. {
  3.     public static void Main()
  4.     {
  5.         bool isInvalidInput = false;
  6.         bool isTie = false;
  7.        
  8.         do
  9.         {
  10.             Console.WriteLine("Jack Please enter 1 for Paper, 2 for Rock, 3 for Scissors:");
  11.             string jackInput = Console.ReadLine();
  12.             Console.WriteLine("Jill Please enter 1 for Paper, 2 for Rock, 3 for Scissors:");
  13.             string jillInput = Console.ReadLine();
  14.            
  15.             if (IsInvalidInput(jackInput) || IsInvalidInput(jillInput))
  16.             {
  17.                 Console.WriteLine("Invalid input detected, please insert 1, 2, or 3");
  18.                 isInvalidInput = true;
  19.             }
  20.             else
  21.             {  
  22.                 isInvalidInput = false;
  23.                 // convert input to numbers
  24.                 if (Jack == Jill)
  25.                 {
  26.                     Console.WriteLine("Nobody wins");
  27.                     isTie = true
  28.                 }
  29.                 else
  30.                 {
  31.                     //el resto del juego
  32.                 }  
  33.             }  
  34.         }
  35.         while (isTie || isInvalidInput);           
  36.     }
  37.  
  38.     private static bool IsInValidInput(string input)
  39.     { //check if input is invalid
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement