C语言 输入一个汉字五分制成绩(优/良/中/及格/不及格),输出汉字五分制成绩对应的百分制成绩范围(90-100/80-89/70-79/60-69/0-59)
c语言
程序代码:
#include <stdio.h> #include <string.h> int main() { char *an[5]={"优","良","中","及格","不及格"}; char *ad[5]={"90-100","80-89","70-79","60-69","0-59"}; int i; char n[10]; scanf("%s",n); for (i=0;i<5;++i) { if (strcmp(n,an[i])==0) { printf("%s %s\n", an[i],ad[i]); break; } } return 0; }