从键盘输入一个整数,当输入1~7时,显示下面对应的英文星期名称和缩写.
1个回答
展开全部
#include <stdio.h>
char *txt[] = { "Mon.","Tue.","Wed.","Thu.","Fri.","Sat.","Sun." };
int main()
{
int w;
scanf("%d", &w);
while (w != 0)
{
if (1 <= w && w <= 7)
printf("%s\n", txt[w - 1]);
else
printf("Error!\n");
scanf("%d", &w);
}
return 0;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询