コード例 #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
ファイル: Program.cs プロジェクト: rgm9496/HFSCprojects
        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
ファイル: Program.cs プロジェクト: Callum-Roberts/HSFC
        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();
        }