static void Main(string[] args) { //This is the main Class from which every class objects are created Console.WriteLine("Enter 1 for UnOrderedList.\nEnter 2 for OrderedList " + "\n" + "Enter 3 for BalancedParantheses \n" + "Enter 4 for CashCounter \n" + "Enter 5 for PalidromeCheck \n" + "Enter 6 for BinarySearchTree \n" + "Enter 7 for HashFunction\n" + "Enter 8 for PrimeNumber2Dimension \n" + "Enter 9 for Anagrams in array\n" + "Enter 10 for AnagranToStack\n" + "Enter 11 for AnagranToQue\n" + "Enter 12 for Calender"); int number = int.Parse(Console.ReadLine()); //by using a static method called DriverMethod to invoke the particular class switch (number) { case 0: new Test(); break; case 1: ReadFromFile.DriverMethod(); break; case 2: FileReader.DriverMethod(); break; case 3: BalancedParentheses.DriverMethod(); break; case 4: new CashCounter(); break; case 5: PalindromeChecker.DriverMethod(); break; case 6: BinarySearchTree.DriverMethod(); break; case 7: HashTable.DriverMethod(); break; case 8: PrimeNumber2Dimension.DriverMethod(); break; case 9: Anagram.DriverMethod(); break; case 10: AnagramToStack.DriverMethod(); break; case 11: AnagramToQue.DriverMethod(); break; case 12: Calender.DriverMethod(); break; default: Console.WriteLine("invalid Entry");; break; } }
public static void DriverMethod() { Anagram n = new Anagram(); Console.Write("Enter the low range: "); int low = int.Parse(Console.ReadLine()); Console.Write("Enter the High range: "); int high = int.Parse(Console.ReadLine()); List <int> prime = n.PrimeRange(low, high); List <int> anagram = n.PrimeAnagram(prime); int[,] arr = n.Anagrams(prime, anagram); n.Display(arr); }
public static void DriverMethod() { Anagram a = new Anagram(); //this method gives primenumbers in a range in a List List <int> Prime_list = a.PrimeRange(0, 1000); //this method takes list of Prime numbers and returns list of anagrams //from the Prime numbers list List <int> Anagram_List = a.PrimeAnagram(Prime_list); //filling Que with Prime Anagrams from List Queue <int> q = new Queue <int>(Anagram_List.Size()); for (int i = 0; i < Anagram_List.Size(); i++) { q.Enqueue(Anagram_List.peek(i)); } //Displaying The Que filled with anagrams from 0 to 1000 Console.WriteLine("Anagrams Stored in Que Are: "); Console.WriteLine(q); }
public static void DriverMethod() { Anagram a = new Anagram(); AnagramToStack ra = new AnagramToStack(); List <int> prime_list = a.PrimeRange(0, 1000); List <int> Anagram_list = a.PrimeAnagram(prime_list); Stack <int> s = new Stack <int>(Anagram_list.Size()); //storing anagrams form list to stack for (int i = 0; i < Anagram_list.Size(); i++) { s.Push(Anagram_list.peek(i)); } Console.WriteLine("Anagrams stored in Stack are: "); Console.WriteLine(s); // Console.WriteLine("displaying Anagreams Reverse : "); while (!s.IsEmpty()) { Console.Write(ra.Reverse(s.Pop()) + " "); } }