江湖中人向来都是不鸣则已,一鸣惊人。总有一天我要下天山,威振武林!
score = (score - score%10) /10
switch(score)
把你们的改了下 试试也挺好用
main()
{
float score ;int c=0;
char grade ;
printf("please input a score\n");
while(1){
scanf("%f",&score);
if(score<0)
break;
if(score>=90)
c=1;
if((score>=60)&&(score<90))
c=2;
if(score<60)
c=3;
switch(c)
{
case 1 :
printf("%f",score);
printf("belong to grade=A\n");break;
case 2 :
printf("%f",score);printf("belong tograde=B\n");break;
default:
printf("%f",score);
printf("grade=C\n");
break;
}
#include <stdio.h>
void main()
{
float score;
char grade;
int m;
printf("please input score: \n");
scanf("%f",&score);
m=score/30;
switch(m)
{
case 3 : grade='A';
break;
case 2 : grade='B';
break;
default: grade='C';
break;
}
printf("%f belongs to c%.\n",score,grade);
}