switch(alpha)
{ case alphaaa:
balahabdbajdadnkjandjan
break;
}
实例:
代码语言:javascript复制#include <stdio.h>
int main() {
int a;
printf("您好,这是自助贩卖机n1.矿泉水n2.巧克力n3.爆米花n4.果汁n5.数量n6.退出系统n请输入1~6的数字:");
scanf("%d", &a);
switch (a) {
case 1:
printf("矿泉水");
break;
case 2:
printf("巧克力");
break;
case 3:
printf("爆米花");
break;
case 4:
printf("果汁");
break;
case 5:
printf("数量");
break;
case 6:
printf("退出系统");
break;
}
}