static void Main(string[] args) { bool flag = true; while (flag) { Console.WriteLine("Functional Programs"); Console.WriteLine("1.Two Dimensional Array"); Console.WriteLine("2.Triplets Add To Zero"); Console.WriteLine("3.Distance"); Console.WriteLine("4.Quadratic"); Console.WriteLine("5.WindChill"); Console.WriteLine("6.Exit"); Console.Write("\nEnter your choice: "); int choice = Convert.ToInt32(Console.ReadLine()); switch (choice) { case 1: TwoDArray.input(); break; case 2: TripletsAddZero.ArrayInput(); break; case 3: Distance.Input(); break; case 4: QuadraticEquation.Input(); break; case 5: WindChill.Input(); break; case 6: flag = false; break; default: Console.WriteLine("\nEnter valid choice\n"); break; } } }
/// <summary> /// define the entry point of the application /// </summary> /// <param name="args">The arguments.</param> public static void Main(string[] args) { try { int choose; string yes; do { Console.WriteLine(" 1.StringReplace \n 2.FlipCoin \n 3.LeapYear \n 4.PowerOfTwo \n 5.HarmonicNumber \n 6.PrimeFactor "); Console.WriteLine(" 7.Gambler \n 8.CouponNumber \n 9.2DArry \n 10.FindTriplets \n 11.FindThedistance \n 12.permutation "); Console.WriteLine(" 13.StopWatch \n 14.TIC_TAC_TOE_GAME \n 15.QudraticEquation \n 16.WindChill"); Console.WriteLine("enter the your choose"); choose = Convert.ToInt32(Console.ReadLine()); switch (choose) { case 0: Environment.Exit(0); break; case 1: StringReplace.Replace(); break; case 2: FlipCoin.CoinFlip(); break; case 3: LeapYear.Yearleap(); break; case 4: PowerOfTwo.TwoToThePower(); break; case 5: HarmonicNumber.Harmonicnumber(); break; case 6: PrimeFactor.Primefactor(); break; case 7: GamblerProgram.Gambler(); break; case 8: CouponNumbers.Couponnumbers(); break; case 9: TwoDArray.TwodArray(); break; case 10: FindTriplets.Integernumber(); break; case 11: DistanceProgram.CalculateDistance(); break; case 12: Permutation.PermutationNumber(); break; case 13: StopWatch.Watch(); break; case 14: Tic_Tac_Toe.Tic_tac_toe(); break; case 15: QudraticEquation.Equation(); break; case 16: WindChill.Wind(); break; default: Console.WriteLine("enter the valid choose"); break; } Console.WriteLine("do you want continue"); yes = Console.ReadLine(); } while (choose != 0 && yes != "no"); } catch (Exception e) { Console.WriteLine(e.Message); } }
/// <summary> /// Defines the entry point of the application. /// Main method is used to take user choice to perform operations /// </summary> /// <param name="args"></param> static void Main(string[] args) { Boolean flag = false; while (flag == false) { //choice variable stores the choice of user int choice; try { do { //Read choice of Operations which user wants to perform Console.WriteLine("\n 1.Find Triplets \t 2.Distance \t 3.Quadratic \t 4.Wind Chill \t 5.2D Array \t 6.Exit\n Enter your Choice:"); choice = Convert.ToInt32(Console.ReadLine()); switch (choice) { case 1: //if user wants to find triplets which exactly sum 0 SumOfThreeInt sumOfThreeInt = new SumOfThreeInt(); sumOfThreeInt.PrintSumOfThreeInt(); flag = true; break; case 2: //if user wants to find Distance Distance distance = new Distance(); distance.PrintDistance(); flag = true; break; case 3: //if user wants to find roots of the equation Quadratic quadratic = new Quadratic(); quadratic.PrintQuadratic(); flag = true; break; case 4: //if user wants to calculate wind chill WindChill wind = new WindChill(); wind.PrintWindChill(); flag = true; break; case 5: //if user wants to Print values in 2D Array into file TwoDArray twoDArray = new TwoDArray(); twoDArray.PrintTwoDArray(); flag = true; break; case 6: //if user wants to Exit flag = true; break; default: Console.WriteLine("Please enter Correct Choice"); break; } } while (choice != 6); } catch (Exception e) { Console.WriteLine("Please enter Correct Choice"); flag = false; } } Console.ReadKey(); }