Enter a letter of the day of the week to determine the day of the week, if not judged, then continue to enter the next letter, such as can not,
Enter the next letter until you can judge it, and count the number of letters you can enter when judging.
<pre name= "code" class= "CSharp" >using system;using system.collections.generic;using system.linq;using system.text;//Enter the day of the week a letter to determine the day of the week, if not judged, then continue to enter the next letter, such as can not,//and then enter the next letter, until it can be judged, and statistics to the number of letters entered can be judged namespace Consoleapplication1{class Program {static void Main (string[] args) {char[] Week1 = new C har[10];//character array int i = 0; Console.WriteLine ("The program can only enter one or two letters to determine the days of the Week"); Console.Write ("Please enter the First Capital letter:"); Week1[i] = Convert.tochar (Console.ReadLine ()); Switch (Week1[i]) {case ' M ': Console.Write ("monday\n"); Case ' W ': Console.Write ("wednesday\n"); Break Case ' F ': Console.Write ("friday\n"); Break Case ' S ': Console.Write ("Please enter a second lowercase letter:"); Week1[i + 1] = Convert.tochar (Console.ReadLine ()); if (week1[i + 1] = = ' a ') Console.Write ("saturday\n"); else if (wEek1[i + 1] = = ' u ') console.write ("sunday\n"); else Console.Write ("no answer \ n"); Break Case ' T ': Console.Write ("Please enter a second lowercase letter:"); Week1[i + 1] = Convert.tochar (Console.ReadLine ()); if (week1[i + 1] = = ' u ') console.write ("tuesday\n"); else if (week1[i + 1] = = ' h ') console.write ("thursday\n"); else Console.Write ("no answer \ n"); Break Default:Console.Write ("no answer \ n"); Break } console.read (); } }}
C # Programming: Enter a letter of the day of the week to determine the day of the week