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(); }
// CORE MET /// <summary> /// A code wrapper for Int32 type. /// </summary> public static void Wrapper() { // Printing instructions Console.Clear(); Console.WriteLine(Int32_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, 6); // Receive user inputs Console.WriteLine(new String('-', 40) + "\nINPUT\n"); int userInputInt32 = (int)Program.HandleNumInput(Console.ReadLine()); Console.WriteLine(new String('-', 40) + "\nOUTPUT\n"); // Calling mets based on options including args switch (userMet) { case 1: int res_case1 = Int32_Section.M01_TurnNegative(userInputInt32); Console.WriteLine($"The result: {res_case1}"); break; case 2: bool res_case2 = Int32_Section.M02_EvenOrOdd(userInputInt32); Console.WriteLine($"The number is even: {res_case2}"); break; case 3: double res_case3 = Int32_Section.M03_OddCount(userInputInt32, out int[] arr_case3); Console.WriteLine($"The number of odd integer: {res_case3}"); Console.WriteLine($"The number sequence: {String.Join(",", arr_case3)}"); break; case 4: Console.WriteLine("Type in the first divisor:"); Int32.TryParse(Console.ReadLine(), out int divisor1); Console.WriteLine("Type in the second divisor:"); Int32.TryParse(Console.ReadLine(), out int divisor2); bool res_case4 = Int32_Section.M04_IsDivisible(userInputInt32, divisor1, divisor2); Console.WriteLine($"The number is divisible to {divisor1} AND {divisor2}: {res_case4}"); break; case 5: if (userInputInt32 < 0) { Console.WriteLine("Inputed number must be a positive integer!"); break; } int res_case5 = Int32_Section.M05_ZeroToNumSum(userInputInt32, out int[] arr_case5); Console.WriteLine($"The sum: {res_case5}"); Console.WriteLine($"The number sequence: {String.Join(",", arr_case5)}"); break; case 6: if (userInputInt32 >= 13 || userInputInt32 < 0) { Console.WriteLine($"Value unacceptable!"); break; } else { int res_case6 = Int32_Section.M06_Factorial(userInputInt32); Console.WriteLine($"{userInputInt32}! = {res_case6}"); break; } default: Console.WriteLine("Unknown methods!"); break; } }