+ 1

Where is there a mistake?

#include"stdio.h" void main() {int a; printf("请输入数字:"); canf("%d",&a); switch(a) {case a>=100:prinf("错误/n");break; case a>=90:prinf("优秀/n");break; case a>=80:prinf("良好/n");break; case a>=70:prinf("中等/n");break; case a>=60:prinf("及格/n");break; case a>=0:prinf("不及格/n");break; default:printf("错误/n"); } }

30th Mar 2018, 3:42 AM
Clearlove
4 Respostas
+ 5
#include <stdio.h> int main() { int a; printf("请输入数字:"); scanf("%d",&a); if (a>=100) printf("错误/n"); else if (a>=90) printf("优秀/n"); // etc } 注:switch只限使用于单数case,如 case 1,case 2, case 10。如若想衡量范围内的数目,如 < 5,>= 10,皆需 if else。
30th Mar 2018, 4:13 AM
Hatsy Rei
Hatsy Rei - avatar
+ 1
试一试把 "canf" 变成 "scanf."
30th Mar 2018, 3:49 AM
LunarCoffee
LunarCoffee - avatar
0
Canf是什么? 用cin和cout好不好? C++ 不是C
30th Mar 2018, 3:46 AM
Code Monkey