#include
int main()
{
double score;
printf("输入:\n");
scanf("%lf",&score);
switch((int)(score/10))//switch((int)score/10)出现严重错误,switch(((int)score)/10)出现严重错误,
{ case 10: case 9:printf("monday)\n");break; case 8:printf("tue)\n");break; case 7:printf("wed)\n");break; case 6:printf("(thu)\n");break; case 5:printf("(fri)\n");break; case 4: printf("(sat)\n");break; case 3: printf("(sun)\n");break; case 2: case 1:
default:printf("Error!\n");
}
}
main()
{
int i;
printf("Input(1--7):");
scanf("%d",&i);
switch(i)
{ case 1: printf("Mondy\n");break;
case 2: printf("Tuesday\n");break;
case 3: printf("Wednesday\n");break;
case 4: printf("Thursday\n");break;
case 5: printf("Friday\n");break;
case 6: printf("Saturday\n");break;
case 7: printf("Sunday\n");break;
default: printf("Error!\n");
}
}
int a;
printf("input a number from 1to 7\n");
scanf("%d“,&a);
switch(a)
{
case 1 :printf("Monday\n");break;
case 2 :printf("Tuseday\n");break;
case 3 :printf("Wednesday\n");break;
case 4 :printf("Thursday\n");break;
case 5 :printf("Friday\n");break;
case 6 :printf("Saturday\n");break;
case 7 :printf("Sunday\n");break;
default: printf("error,please input1~7\n");
}
int n;
scanf("%d",&n);
switch(n)
{
case I:printf("Monday");
.
.
.
.
case 7:printf("Sunday");
}
应该就这样,如果记得不错的话。
#include
main()
{
int a;
printf("please input a number between 1 to 7 :%d",a);
scanf("%d",&a);
switch(a)
{
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;
}