Example #1
0
 static bool CheckTicket(RandomArr lotery, int[] ticket)
 {
     for (var i = 0; i < ticket.Length; i++)
     {
         for (var j = 0; j < lotery.GetLength(); j++)
         {
             if (ticket[i] == lotery[j])
             {
                 break;
             }
             else if (j == lotery.GetLength() - 1 && ticket[i] != lotery[lotery.GetLength() - 1])
             {
                 return(false);
             }
         }
     }
     return(true);
 }
Example #2
0
        static void Main(string[] args)
        {
            var arr = new int[6];

            arr = InputLotery(arr);
            var arrLotery = new RandomArr(arr.Length);

            if (CheckTicket(arrLotery, arr))
            {
                Console.Clear();
                Console.WriteLine("You win");
            }
            else
            {
                Console.Clear();
                Console.WriteLine("You lost");
            }
            ShowArr(arr);
            arrLotery.ShowInfo();
            Console.ReadKey();
        }