#include "stdio.h"
#include "stdlib.h"
int main()
{
int score,level;
char band;
printf("Input Score:");
scanf("%d",&score);
level=score/10;
switch(level)
{
case 10:
case 9: band='A'; break;
case 8: band='B'; break;
case 7: band='C'; break;
case 6: band='D'; break;
default: band='E'; break;
}
printf("%d的等级为%c\n",score,band);
system("pause");
return 0;
}
#include
main()
{
int s,y;
y=(int)(s/10);
printf("Input Score:");
scanf(“%d”.&s);
switch(y)
{
case 9:case 10: printf("%d的等级为A",s);break;
case 8: printf("%d的等级为B",s);break;
case 7: printf("%d的等级为C",s);break;
case 6: printf("%d的等级为D",s);break;
default: printf("%d的等级为E",s);
}
}
#include "iostream.h"
#include "stdio.h"
void main()
{
int a;
cin>>a;
int b=a/10;
switch (b)
{
case 10:
cout<<"A"<
cout<<"A"<
cout<<"B"<
cout<<"C"<
cout<<"D"<
cout<<"E"<
}
在switch前面加个b=成绩%10
然后switch(b)
这样的话输入108也会输出A而不是输出错误