Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MenuForSearchSortAlgo"/> class.
        /// </summary>
        public MenuForSearchSortAlgo()
        {
            char condition;

            do
            {
                Console.WriteLine("Press 1 for : Bubble sort for Integer Array");
                Console.WriteLine("Press 2 for : Bubble sort for String Array");
                Console.WriteLine("Press 3 for : Insertion sort for Integer Array");
                Console.WriteLine("Press 4 for : Insertion sort for String Array");
                Console.WriteLine("Press 5 for : Binary search for Integer Array");
                Console.WriteLine("Press 6 for :Binary search for String Array");
                int ch = Convert.ToInt32(Console.ReadLine());
                switch (ch)
                {
                case 1:
                    BubbleSortInt bsi = new BubbleSortInt();
                    break;

                case 2:
                    BubbleSortString bss = new BubbleSortString();
                    break;

                case 3:
                    InsertionSortInt iis = new InsertionSortInt();
                    break;

                case 4:
                    InsertionSortString iss = new InsertionSortString();
                    break;

                case 5:
                    BinarySearchInt bi = new BinarySearchInt();
                    break;

                case 6:
                    BinarySearchString bs = new BinarySearchString();
                    break;

                default:
                    break;
                }

                Console.WriteLine("enter Y to search or sort more / N to exit");
                condition = Convert.ToChar(Console.ReadLine());
            }while (condition == 'y');
            return;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Main Method where execution starts
        /// </summary>
        /// <param name="args">String array</param>
        public static void Main(string[] args)
        {
            char condition;

            do
            {
                Console.WriteLine("Press  1 for : String Anagram");
                Console.WriteLine("Press  2 for : Prime Numbers upto N");
                Console.WriteLine("Press  3 for : Prime Palindromic Anagram Numbers");
                Console.WriteLine("Press  4 for : Menu for Search and Sort");
                Console.WriteLine("Press  5 for : Game of Guessing the number");
                Console.WriteLine("Press  6 for : BinarySearch to search word from file");
                Console.WriteLine("Press  7 for : Insertion sort for String Array");
                Console.WriteLine("Press  8 for : Bubble sort for Integer Array");
                Console.WriteLine("Press  9 for : Merge Sort for String");
                Console.WriteLine("Press 10 for : Vending Machine");
                Console.WriteLine("Press 11 for : Day Of the week of entered date");
                Console.WriteLine("Press 12 for : Temperature Conversion");
                Console.WriteLine("Press 13 for : Monthly Payment");
                Console.WriteLine("Press 14 for : Square Root using Newton Method");
                Console.WriteLine("Press 15 for : Convert number to Binary");
                try
                {
                    int ch = Convert.ToInt32(Console.ReadLine());
                    switch (ch)
                    {
                    case 1:
                        Anagram a = new Anagram();
                        break;

                    case 2:
                        Prime p = new Prime();
                        break;

                    case 3:
                        PalPrimeAnagram p1 = new PalPrimeAnagram();
                        break;

                    case 4:
                        MenuForSearchSortAlgo mss = new MenuForSearchSortAlgo();
                        break;

                    case 5:
                        QuestionGame qg = new QuestionGame();
                        break;

                    case 6:
                        ReadFromFile rf = new ReadFromFile();
                        break;

                    case 7:
                        InsertionSortString in1 = new InsertionSortString();
                        break;

                    case 8:
                        BubbleSortInt bbi = new BubbleSortInt();
                        break;

                    case 9:
                        MergeString ms = new MergeString();
                        break;

                    case 10:
                        VendingMachine vm = new VendingMachine();
                        break;

                    case 11:
                        DayOfWeek dow = new DayOfWeek();
                        break;

                    case 12:
                        Temperature t = new Temperature();
                        break;

                    case 13:
                        MonthlyPayment mp = new MonthlyPayment();
                        break;

                    case 14:
                        SqrtNewtonMethod sq = new SqrtNewtonMethod();
                        break;

                    case 15:
                        ToBinary tb = new ToBinary();
                        break;

                    default:
                        break;
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }

                Console.WriteLine("enter Y for Main Menu / N to exit");
                condition = Convert.ToChar(Console.ReadLine());
            }while (condition == 'y');
        }