Exemplo n.º 1
0
        public static void Main()
        {
            Console.WriteLine("Welcome to the Word Counter!");
            Console.WriteLine("Please enter a word");
            string newWord = Console.ReadLine();

            Console.WriteLine("Please ender a sentence");
            string        newSentence = Console.ReadLine();
            RepeatCounter newCounter  = new RepeatCounter(newWord, newSentence);
            int           finalOutput = newCounter.CountWord();

            Console.WriteLine("your word " + "~ " + newWord + " ~" + " repeats " + finalOutput + " time(s) in your sentence.");
        }
Exemplo n.º 2
0
        public static void Main()
        {
            Console.WriteLine("Enter Your Word.");
            string        firstWord = Console.ReadLine();
            RepeatCounter wordCount = new RepeatCounter(firstWord);

            Console.WriteLine("Enter Your Sentence.");
            string enterSentence = Console.ReadLine();
            int    wordSum       = wordCount.CountWord(enterSentence);

            Console.WriteLine("Your Word Appears " + wordSum);
            Console.WriteLine("Would You Like To Restart: Y/N");
            string restartGame = Console.ReadLine();

            if (restartGame.Equals("Y"))
            {
                Main();
            }
        }