Beispiel #1
0
        public static void Main()
        {
            bool isDone = true;

            Console.WriteLine("Please enter your Word to check for anagram");
            string firstWord = Console.ReadLine();

            while (isDone == true)
            {
                Console.WriteLine("Would you like to add a new word or compare to anagram word? (add/compare)");
                string userInput = Console.ReadLine();
                if (userInput == "add")
                {
                    Console.WriteLine("Please enter your item ");
                    string  newWord1   = Console.ReadLine();
                    Anagram newAnagram = new Anagram(newWord1);
                    newAnagram.Save();
                }
                else if (userInput == "compare")
                {
                    isDone = false;
                }
            }
            List <Anagram> instances = Anagram.GetList();

            Console.WriteLine("These words are anagrams of " + firstWord);
            foreach (Anagram word in instances)
            {
                // Anagram newAnagram1 = new Anagram ("something");
                string wordX = Anagram.anagramWordSort(firstWord);
                string wordY = Anagram.anagramWordSort(word.GetCompareWord());
                if (Anagram.CompareTwoWords(wordX, wordY))
                {
                    Console.WriteLine(word.GetCompareWord());
                }
            }
        }