コード例 #1
0
        private static void Main(string[] args)
        {
            string text = string.Empty;

            while (text != exit)
            {
                Console.WriteLine("Input text for calculate average length of words, 0 for exit");
                text = Console.ReadLine();
                switch (text)
                {
                case empty:
                    Console.WriteLine("You input empty string, try again");
                    break;

                case exit:
                    Console.WriteLine("Press any key for exit");
                    Console.ReadKey();
                    return;

                default:
                    MyString obj = new MyString(text);
                    Console.WriteLine("Average length of words :{0}", obj.Average_word_length());
                    break;
                }
            }
        }