是 switch case吧 你也不说是什么语言
给你个C语言的吧
loop:
printf("请输入1-7:\n");
scanf("%d",&x);
printf("\n");
switch
{case 1;
printf("Monday");
break;
case 2;
printf("Tuesday");
break;
case 3;
printf("Wednesday");
break;
case 4;
printf("Thursday");
break;
case 5;
printf("Friday");
break;
case 6;
printf("Saturday");
break;
case 7;
printf("Sunday");
break;
default:
printf("你输入的啥玩意呀,重新输!");
goto loop;
}
#include
void main()
{
int n;
cout<<"请输入数字星期(1-7):";
cin>>n;
cout<<"对应的英文星期为:";
switch(n)
{
case 1:cout<<"Monday";break;
case 2:cout<<"Tuesday";break;
case 3:cout<<"Wednesday";break;
case 4:cout<<"Thursday";break;
case 5:cout<<"Friday";break;
case 6:cout<<"Saturday";break;
case 7:cout<<"Sunday";break;
}
cout<