C # Programming: Enter a letter of the day of the week to determine the day of the week

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.