コード例 #1
0
        // CORE MET

        /// <summary>
        /// A code wrapper for Array 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:
                break;

            default:
                Console.WriteLine("Unknown methods!");
                break;
            }
        }
コード例 #2
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;
            }
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: phquang98/csharp_cmdapp001
        static void Main(string[] args)
        {
            // Testing zone

            // Introduction to the program
            Console.WriteLine(Program.PrintIntro());

            // Choosing sections
            Console.WriteLine("Please type in the number of your choosing section:");
            string userInput   = Console.ReadLine();
            int    userSection = Program.Choose(userInput, 1, 10);

            // Calling wrapper mets with desired section
            switch (userSection)
            {
            case 1: // Int32 Section
                Int32_Section.Wrapper();
                break;

            case 2: // Double Section
                Int32_Section.Wrapper();
                break;

            case 3: // Decimal Section
                Int32_Section.Wrapper();
                break;

            case 4: // Character Section
                Int32_Section.Wrapper();
                break;

            case 5: // String Section
                Int32_Section.Wrapper();
                break;

            case 6: // Array Section
                Int32_Section.Wrapper();
                break;

            case 7: // DateTime Section
                Int32_Section.Wrapper();
                break;

            case 8: // List Section
                Int32_Section.Wrapper();
                break;

            case 9: // Dictionary Section
                Int32_Section.Wrapper();
                break;

            case 10: // Others
                Others_Section.Wrapper();
                break;

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

            Console.WriteLine("Press Enter to exit...");
            Console.ReadLine();
        }