コード例 #1
0
        /// <summary>
        /// Defines the entry point of the application.
        /// </summary>
        /// <param name="args">The arguments.</param>
        public static void Main(string[] args)
        {
            try
            {
                char ans;
                do
                {
                    Console.WriteLine("1.Linked List Operations For String ");
                    Console.WriteLine("2.Linked List Operations For Integer ");
                    Console.WriteLine("3.Balanced Parenthesis ");
                    Console.WriteLine("4.Bank Cash Counter ");
                    Console.WriteLine("5.Calender");
                    Console.WriteLine("6.Palindrome Checker");
                    Console.WriteLine("7.Prime number 2D array");
                    Console.WriteLine("8.Prime Anagram number 2D array");
                    Console.WriteLine("9.Prime Anagram numbers using Stack");
                    Console.WriteLine("10.Prime Anagram numbers using Queue");
                    Console.WriteLine("11.Number of Binary Search Trees");
                    Console.WriteLine("12.Hashing Array");

                    int ch = Convert.ToInt32(Console.ReadLine());
                    switch (ch)
                    {
                    case 1:
                        ReadIntoLinkedList <string> b = new ReadIntoLinkedList <string>();
                        break;

                    case 2:
                        ReadIntegerFromFile <int> b1 = new ReadIntegerFromFile <int>();
                        b1.OrderedListOperation();
                        break;

                    case 3:
                        BalanceParenthesis b2 = new BalanceParenthesis();
                        b2.CheckBalancedParenthesis();
                        break;

                    case 4:
                        BankCashCounter bcc = new BankCashCounter();
                        bcc.BankCashCounterOperations();
                        break;

                    case 5:
                        Calendar.DisplayCalendar();
                        break;

                    case 6:
                        PalindromeChecker pc = new PalindromeChecker();
                        pc.PalindromeCheckMethod();
                        break;

                    case 7:
                        Prime2DArray.Prime2DOperation();
                        break;

                    case 8:
                        PrimeAnagram2DArray.PrimeAnagramFunction();
                        break;

                    case 9:
                        PrimeAnagramNumberUsingStack ps = new PrimeAnagramNumberUsingStack();
                        ps.PrintPrimeAnagram();
                        break;

                    case 10:
                        PrimeAnagramNumberUsingQueue pq = new PrimeAnagramNumberUsingQueue();
                        pq.PrintPrimeAnagram();
                        break;

                    case 11:
                        InputBinary.BinaryTree();
                        break;

                    case 12:
                        InputForHashing input = new InputForHashing();
                        input.CallHashingFunction();
                        break;

                    default:
                        Console.WriteLine("Invalid Choice...");
                        break;
                    }

                    Console.WriteLine("\nDo you want to continue in Menu (y/n) : ");
                    ans = Convert.ToChar(Console.ReadLine());
                }while (ans == 'Y' || ans == 'y');
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            Console.WriteLine("Thank you...");
        }
コード例 #2
0
        /// <summary>
        /// Defines the entry point of the application.
        /// </summary>
        /// <param name="args">The arguments.</param>
        static void Main(string[] args)
        {
            Console.WriteLine("1: UnOrdered List");
            Console.WriteLine("2: Ordered List");
            Console.WriteLine("3: Simple Balanced Parentheses");
            Console.WriteLine("4: Simulate Banking Cash Counter");
            Console.WriteLine("5: Palindrome-Checker");
            Console.WriteLine("6: Hashing function to search a Number in a slot");
            Console.WriteLine("7: Number of Binary Search Tree");
            Console.WriteLine("8: Prime Numbers");
            Console.WriteLine("9: Prime Anagrams");
            Console.WriteLine("10: Prime Anagrams using Stack");
            Console.WriteLine("11: Prime Anagrams using Queue");
            Console.WriteLine("12: Calender - Printing Month");
            int choice = 0;

            while (!(choice > 0 && choice < 13))
            {
                try
                {
                    Console.Write("Enter your choice: ");
                    choice = Convert.ToInt32(Console.ReadLine());
                }
                catch (FormatException)
                {
                    //Console.WriteLine(Ex);
                }
            }
            switch (choice)
            {
            case 1:
                UnOrderedList list = new UnOrderedList();
                list.Run();
                break;

            case 2:
                OrderedList orderedList = new OrderedList();
                orderedList.Run();
                break;

            case 3:
                BalancedParanthesis balancedParanthesis = new BalancedParanthesis();
                balancedParanthesis.Check();
                break;

            case 4:
                BankingCashCounter cashCounter = new BankingCashCounter();
                cashCounter.Simulate();
                break;

            case 5:
                PalindromeChecker palindrome = new PalindromeChecker();
                palindrome.Check();
                break;

            case 6:
                Hashing hashing = new Hashing();
                hashing.Chaining();
                break;

            case 7:
                NumberOfBST numberOfBST = new NumberOfBST();
                numberOfBST.Calculate();
                break;

            case 8:
                PrimeNumbers primeNumbers = new PrimeNumbers();
                primeNumbers.prime();
                break;

            case 9:
                PrimeAnagrams primeAnagrams = new PrimeAnagrams();
                primeAnagrams.Anagram();
                break;

            case 10:
                PrimeAnagramUsingStack primeAnagramUsingStack = new PrimeAnagramUsingStack();
                primeAnagramUsingStack.reversePrinting();
                break;

            case 11:
                PrimeAnagramUsingQueue primeAnagramUsingQueue = new PrimeAnagramUsingQueue();
                primeAnagramUsingQueue.printAnagram();
                break;

            case 12:
                Calendar calendar = new Calendar();
                calendar.printMonth();
                break;
            }
        }