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