Пример #1
0
        private static void Main(string[] args)
        {
            Console.Write("Enter the number of cards to pick: ");
            string numberOfCardsToPick = Console.ReadLine();

            if (int.TryParse(numberOfCardsToPick, out int numberOfCards))
            {
                foreach (string card in CardPicker.PickRandonCards(numberOfCards))
                {
                    Console.WriteLine(card);
                }
            }
            else
            {
                Console.WriteLine("Invalid Input");
            }
        }
Пример #2
0
        static void Main(string[] args)
        {
            Console.Write("Enter a number of cards to pick: ");
            string line = Console.ReadLine();

            if (int.TryParse(line, out int numberOfCards))
            {
                /*This foreach loop executes Console.WriteLine(card) for each
                 * element in the array returned by PickSomeCards. */
                foreach (string card in CardPicker.PickSomeCards(numberOfCards))
                {
                    Console.WriteLine(card);
                }
            }
            else
            {
                Console.WriteLine("Please enter a valid number.");
            }
        }