コード例 #1
0
        // CORE MET

        /// <summary>
        /// A code wrapper for Others section.
        /// </summary>
        public static void Wrapper()
        {
            // Printing instructions
            Console.Clear();
            Console.WriteLine(Others_Section.PrintInstruction());

            // Choosing mets
            Console.WriteLine("METHOD:\n");
            Console.WriteLine("Please type in the number of your choosing methods:");
            int userMet = Program.Choose(Console.ReadLine(), 1, 3);

            // Receive user inputs
            Console.WriteLine(new String('-', 40) + "\nINPUT\n");

            // Calling mets based on options including args and print output
            switch (userMet)
            {
            case 1:
                Console.WriteLine("Type in n (from 1 to n), then the first divisor then the second divisor:");
                List <string> userInputCase1 = Program.HandleMulInputStr(Console.ReadLine());
                List <string> res_case1      = Others_Section.M01_FizzBuzz(Convert.ToInt32(userInputCase1[0]), Convert.ToInt32(userInputCase1[1]), Convert.ToInt32(userInputCase1[2]));
                Console.WriteLine(new String('-', 40) + "\nOUTPUT\n");
                Console.WriteLine($"The result:\n {String.Join(" ", res_case1)}");
                break;

            case 2:
                Console.WriteLine("Type in order the shape and all necessary values (like edge lengths, ...):");
                List <string> userInputCase2          = Program.HandleMulInputStr(Console.ReadLine());
                Dictionary <string, double> res_case2 = Others_Section.M02_Cal2d(userInputCase2);
                Console.WriteLine(new String('-', 40) + "\nOUTPUT\n");
                foreach (KeyValuePair <string, double> kvp in res_case2)
                {
                    Console.WriteLine("{0}: {1}",
                                      kvp.Key, kvp.Value);
                }
                break;

            default:
                Console.WriteLine("Unknown methods!");
                break;
            }
        }