C语言一个比较细节的问题 高手来看

来源:百度知道 编辑:UC知道 时间:2024/06/06 13:51:08
#include<stdio.h>
void main()
{
char c;
while((c=getch())!='0')
{
switch(c)
{
case 'M':printf("Mon\n");break;
case 'T':printf("please input second letter:");
if((c=getch())=='U')
printf("Tue\n");
else if((c=getch())=='H')
printf("Thu\n");
break;
case 'W':printf("Wed\n");break;
case 'F':printf("Fri\n");break;
case 'S':printf("please input second letter:");
if((c=getch())=='A')
printf("Sat\n");
else if((c=getch())=='U')
printf("Sun\n&

#include<stdio.h>
#include"conio.h"
void main()
{
char c;
while((c=getch())!='0')
{
switch(c)
{
case 'M':printf("Mon\n");break;
case 'T':printf("please input second letter:");
if((c=getch())=='U')
printf("Tue\n");
else if(c=='H') /////////////////////////////////
printf("Thu\n");
break;
case 'W':printf("Wed\n");break;
case 'F':printf("Fri\n");break;
case 'S':printf("please input second letter:");
if((c=getch())=='A')
printf("Sat\n");
else if(c=='U') /////////////////////////////////
printf("Sun\n");
break;
default:printf("data error!\n");
}
}
}

正确code如上,改了两处,自己看吧,很简单,不用细说了,彼此都不浪费时间