十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
#include \x0d\x0aint main() {\x0d\x0a int s, d;\x0d\x0a printf("输入成绩(百分制): ");\x0d\x0a scanf("%d", s);\x0d\x0a d = s / 10;\x0d\x0a switch (d) {\x0d\x0a case 10:\x0d\x0a printf("满分。\n");\x0d\x0a break;\x0d\x0a case 9: case 8:\x0d\x0a printf("优秀。\n");\x0d\x0a break;\x0d\x0a case 7: case 6:\x0d\x0a printf("合格。\n");\x0d\x0a break;\x0d\x0a default:\x0d\x0a printf("不及格。\n");\x0d\x0a }\x0d\x0a return 0;\x0d\x0a}
成都创新互联公司于2013年成立,先为蓟州等服务建站,蓟州等地企业,进行企业商务咨询服务。为蓟州企业网站制作PC+手机+微官网三网同步一站式服务解决您的所有建站问题。
#include stdio.h
int main()
{
int score ;
printf("input a score: ");
scanf("%d",score );
if ( score 100 || score0 )
printf("输入数据错误\n" );
else
{
switch( score/10 )
{
case 9: case 10:
printf("A\n"); break;
case 8:
printf("B\n"); break;
case 7:
printf("C\n"); break;
case 6:
printf("D\n"); break;
default:
printf("E\n"); break;
}
}
return 0;
}
strcpy(students[i].grade,"set_grade(score)"); = students[i].grade=set_grade(score);
students[i].grade-"D"==0 = students[i].grade-'D'==0
#include stdio.h
int main()
{
int score, m;
scanf("%d", score);
while (score 0 || score 100){
printf("Error! Retry!\n");
scanf("%d", score);
}
m= score / 10;
if (m= 9)
printf("Grade is A!\n");
switch(m){
case 0: printf("Grade is E!\n"); break;
case 1: printf("Grade is E!\n"); break;
case 2: printf("Grade is E!\n"); break;
case 3: printf("Grade is E!\n"); break;
case 4: printf("Grade is E!\n"); break;
case 5: printf("Grade is E!\n"); break;
case 6: printf("Grade is D!\n"); break;
case 7: printf("Grade is C!\n"); break;
case 8: printf("Grade is B!\n"); break;
}
return 0;
}
扩展资料:
其他实现输出成绩等级‘A'、’B‘、'C'、‘D'、'E’。90分以上为A,80~89分为B,70~79分为C,60~69分为D,60分一下为E的方法:
#include stdio.h
int main()
{
int score;
scanf("%d", score);
while (score 0 || score 100){
printf("Error! Retry!\n");
scanf("%d", score);
}
if (score 60)
printf("Grade is E!\n");
else if (score = 60 score 70)
printf("Grade is D!\n");
else if (score = 70 score 80)
printf("Grade is C!\n");
else if (score =80 score 90)
printf("Grade is B!\n");
else
printf("Grade is A!\n");
return 0;
}