/*switch条件语句*/
#include<stdio.h>
int main()
{
while (1)
{
int num;
printf("请输入你的选择编号:\n");
scanf("%d", &num);
switch (num)//所传入的参数是在键盘上输入case常量表达式语句的标号
{
case 1:
printf("餐馆一\n");
break;
case 2:
printf("餐馆二\n");
break;
case 3:
printf("餐馆三\n");
break;
default:
printf("其他!");
}
}
return 0;
}
标签:语句,case,条件,break,switch,num,printf
From: https://www.cnblogs.com/weiguanghao/p/17415383.html