예제 #1
0
파일: Program.cs 프로젝트: wm9082/HSFC
        static void Main(string[] args)
        {
            Console.WriteLine("Please enter your poem:");
            WordCounter dictionary = new WordCounter(100);

            string[] poem = Console.ReadLine().Split(" ");
            for (int i = 0; i < poem.Length; i++)
            {
                dictionary.AddWordToList(poem[i]);
            }
            for (int i = 0; i < dictionary.GetNextFreeeLocation(); i++)
            {
                Console.WriteLine(dictionary.GetList()[i].GetWord() + " - " + dictionary.GetList()[i].GetCount());
            }
            Console.ReadLine();
        }
예제 #2
0
        static void Main(string[] args)
        {
            WordCounter dictionary  = new WordCounter(100);
            string      currentWord = "";

            // I should read in line of text
            // process line of text, looking for individual words
            // for each word for WordCounter AddString

            // start with just a word at a time :-)
            while (currentWord != "STOP")
            {
                currentWord = Console.ReadLine();
                if (currentWord != "STOP")
                {
                    dictionary.AddString(currentWord);
                }
            }
        }
예제 #3
0
        static void Main(string[] args)
        {
            WordCounter dictionary  = new WordCounter(100);
            string      currentWord = "";

            Console.WriteLine("Enter you words, one per line, ending with STOP");

            // start with just a word at a time :-)
            while (currentWord != "STOP")
            {
                currentWord = Console.ReadLine();
                if (currentWord != "STOP")
                {
                    dictionary.AddString(currentWord);
                }
            }
            // Now let's print it all out - by autocalling ToString
            Console.WriteLine(dictionary);
            Console.ReadLine();
        }
예제 #4
0
        static void Main(string[] args)
        {
            WordCounter dictionary  = new WordCounter(100);
            string      currentWord = "";

            Console.WriteLine("Enter you words, one per line, ending with STOP");


            while (currentWord != "STOP")
            {
                currentWord = Console.ReadLine();
                if (currentWord != "STOP")
                {
                    dictionary.AddString(currentWord);
                }
            }

            Console.WriteLine(dictionary);
            Console.ReadLine();
        }