C-Determine the day of the week according to the first letter

Source: Internet
Author: User

1#include <stdio.h>2#include <ctype.h>3 4 /*5 Please enter the first letter of the day of the week to determine the day of the week, if the first letter, then continue to judge the second letter. 6 */7 8 //custom get characters that are not case sensitive.9 intTen Get_char () { One     returnToLower (GetChar ()); A } -  - void the What_day () { -     Chartmp//the character to be judged. -TMP =Get_char (); -     Switch(TMP) { +          Case 'm': -printf"Monday \ n"); +              Break; A          Case 'T'://start with ' t ' and analyze further. atprintf"Enter a second character to determine:"); -GetChar ();//line breaks are ignored. -TMP = Get_char ();//for multiple if judgments, save the character to be judged first, not in the If with ' Get_char () ', because each call will fetch a different value. -             if(TMP = ='u') -printf"Tuesday \ n"); -             Else if(TMP = ='h') inprintf"Thursday \ n"); -             Else toprintf"not this week ."); +              Break; -          Case 'W': theprintf"Wednesday \ n"); *              Break; $          Case 'F':Panax Notoginsengprintf"Friday \ n"); -              Break; the          Case 's'://starting with ' s ', further analysis. +printf"Enter a second character to determine:"); AGetChar ();//line breaks are ignored. theTMP =Get_char (); +             if(TMP = ='u') -printf"Sunday \ n"); $             Else if(TMP = ='a') $printf"Saturday \ n"); -             Else -printf"not this week ."); the              Break; -     default:Wuyiprintf"not this week ."); the          Break; -     } Wu}

C-Determine the day of the week according to the first letter

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.