C语言之选择分支结构的应用
#include <stdio.h> void main () { int weekday; printf("今天的食谱\n 请输入星期几\n"); scanf("%d",&weekday); switch (weekday) { case 1:printf("星期一:青菜\n"); break; case 2:printf("星期二:鸡\n"); break; case 3: printf("星期三:鱼\n"); break; case 4: printf("星期四:肉\n"); break; case 5:printf("星期五:鸡蛋\n"); break; case 6: printf("星期六:海鲜\n"); break; case 7: printf("星期日:豆制品\n"); break; default: printf("输入有误\n"); break; } }