去c语言的编程

2026年09月26日 11:53
有2个网友回答
网友(1):

#include
int main(void)
{
int score;
printf("please input the score:");
if(scanf("%d",&score)==1)
{
score/=10;
switch(score)
{
case 10:
case 9:
printf("优秀\n");
break;
case 8:
printf("良好\n");
break;
case 7:
printf("中等\n");
break;
case 6:
printf("及格\n");
break;
default:
printf("不及格\n");
}
}
return 0;
}

网友(2):

int k = 0;
if ((score >= 0) && (score <= 100))
{
if (score >= 90)
{
k = 1;
}
else if ((score >= 80) && (score < 90))
{
k = 2;
}
else if ((score >= 70) && (score < 80))
{
k = 3;
}
else if ((score >= 60) && (score < 70))
{
k = 4;
}
else
{
k = 5;
}
switch(k)
{
case 1:
printf("优秀");
break;
case 2:
printf("良好");
break;
case 3:
printf("中等");
break;
case 4:
printf("及格");
break;
case 5:
printf("不及格");
break;
deafaut:
break;
}
}

考试中求助不好吧。。。。。。。。。。。。。。