Beispiel #1
0
        static void Main(string[] args)
        {
            try
            {
                //ArrayTest.RotateArray(-1, 3);
                ArrayTest.RotateArray(7, 3);
                Console.WriteLine();
                //ArrayTest.RotateArray(20, 6);

                // Missed the example had a method signature to start with
                // Refactored original method RotateArray
                int[] nums = ArrayTest.BuildArray(7);
                ArrayTest.Rotate(nums, 3);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            Console.WriteLine();
            Console.WriteLine("Press any key to exit.");
            Console.ReadKey();
        }
Beispiel #2
0
        private static void Menu()
        {
            text.TextEd("Choose program: Enter Number", "cyan");


            string[] titles = new string[]
            {
                "Triangle Area",
                "Odd or Even",
                "Stars",
                "Fizzle",
                "Array Test",
                "Months of Year",
                "Reverse Array",
                "Rolling Dice",
                "Ball Pop",
                "To Quit"
            };

            for (int i = 0; i < titles.Length; i++)
            {
                text.TextEd("\n" + (i + 1) + ". " + titles[i], "green");
            }


            var choice = text.AskForInt("Enter Input Here:");


            switch (choice)
            {
            case 1:
                Console.Clear();
                Triangle.TriangleArea();
                break;

            case 2:
                Console.Clear();
                OddEven.Check();
                break;

            case 3:
                Console.Clear();
                Stars.Star();
                break;

            case 4:
                Console.Clear();
                Fizzle.Fizz();
                break;

            case 5:
                Console.Clear();
                ArrayTest.ATest();
                break;

            case 6:
                Console.Clear();
                MonthOfYear.NumToMonth();
                break;

            case 7:
                Console.Clear();
                int[] array1 = NumGen.GenerateNumbers();
                ReverseArray.Reverse(array1);
                break;

            case 8:
                Console.Clear();
                Dice.DiceRoll();
                break;

            case 9:
                Console.Clear();
                PlayBall.RedThrow();
                break;

            case 10:
                Console.Clear();
                Environment.Exit(0);
                break;

            default:
                text.TextEd("Please select a choice from the list.", "red");
                break;
            }

            Console.ReadKey();
        }