示例#1
0
        public static string[] ReturnValidStrings()
        {
            bool   sentBool = false;
            bool   wordBool = false;
            string sentResp = "";
            string wordResp = "";

            string[] validInputs = { "", "" };
            while (sentBool == false)
            {
                Console.WriteLine("Enter a sentence: ");
                sentResp = Console.ReadLine();
                Console.WriteLine("");
                sentBool = RepeatCounter.CheckIfValid(sentResp);
                if (!sentBool)
                {
                    Console.WriteLine("Please enter a valid sentence!");
                }
            }
            while (wordBool == false)
            {
                Console.WriteLine("Enter a word: ");
                wordResp = Console.ReadLine();
                Console.WriteLine("");
                wordBool = RepeatCounter.CheckIfValid(wordResp);
                if (!wordBool)
                {
                    Console.WriteLine("Please enter a valid word!");
                }
            }
            validInputs[0] = sentResp;
            validInputs[1] = wordResp;
            return(validInputs);
        }