예제 #1
0
        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);
        }
예제 #2
0
        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()) + " ");
            }
        }