public static void Main() { Boolean flag = true; while (flag) { Console.WriteLine(" "); Console.WriteLine("Program List:"); Console.WriteLine("\n1. Basic Programs\n2. Logical Programs"); Console.WriteLine("3. Functional Program\n4. Algorithmic Programs"); Console.WriteLine("5. Collection\n6. Data Structure"); Console.WriteLine("7. Object Oriented Programming"); Console.WriteLine("8. Design Pattern"); Console.WriteLine("9. Exit "); Console.WriteLine(" "); Console.WriteLine("Enter Your Choice:"); Console.WriteLine(""); try { string input = Console.ReadLine(); if (Regex.IsMatch(input, @"^[0-9]+$")) { int choice = Convert.ToInt32(input); switch (choice) { case 1: BasicPrograms.BasicProgramList(); break; case 2: LogicalPrograms.LogicalProgramList(); break; case 3: FunctionalPrograms.FunctionalProgramList(); break; case 4: AlgorithmPrograms.AlgorithmProgramList(); break; case 5: List.ListExample1(); break; case 6: Data_Structure_Programs.Data_Structure_Program_List(); break; case 7: ObjectOrientedPrograms.ObjectOrientedProgramList(); break; case 8: Design_PatternInput.DesignPatternInputFunction(); break; case 9: Console.WriteLine("Program Exit!!"); flag = false; break; default: Console.WriteLine("Wrong Choice.\nDo you want to work in Program List?\nIf yes press 1 "); if (choice != 0) { Console.WriteLine("Program Exit!!"); flag = false; } break; } } } catch (Exception ex) { Console.WriteLine(ex.Message); } } Console.ReadKey(); }
public static void FunctionalProgramList() { Boolean flag = true; while (flag) { Console.WriteLine(" "); Console.WriteLine("Functional Program List:"); Console.WriteLine("\n1. 2D array \n2. Sum Of three Integers adds to zero"); Console.WriteLine("3. Distance \n4. Quadratic"); Console.WriteLine("5. Windchill"); Console.WriteLine("6. Exit"); Console.WriteLine(" "); Console.WriteLine("Enter Your Choice:"); try { int choice = Convert.ToInt32(Console.ReadLine()); switch (choice) { case 1: TwoDArray.ArrayInput(); break; case 2: SumOfThreeIntegersAddsToZero.SumArray(); break; case 3: Distance.DistanceInput(); break; case 4: Quadratic.QuadraticEquation(); break; case 5: WindChill.Windchill(); break; case 6: Console.WriteLine("Exit!"); flag = false; break; default: Console.WriteLine("Wrong Choice.\nDo you want to work in Functional Program List?\nIf yes press 1 "); choice = Convert.ToInt32(Console.ReadLine()); if (choice == 1) { FunctionalPrograms.FunctionalProgramList(); } else { flag = false; } break; } } catch (Exception ex) { Console.WriteLine(ex.Message); } } }