标签:
90
A
分段函数返回字符
题解:
#include<stdio.h>
int
main()
{
float
score;
char
grade;
scanf
(
"%f"
,&score);
switch
((
int
)(score/10))
{
case
10:
case
9:grade=
‘A‘
;
break
;
case
8:grade=
‘B‘
;
break
;
case
7:grade=
‘C‘
;
break
;
case
6:grade=
‘D‘
;
break
;
case
5:
case
4:
case
3:
case
2:
case
1:
case
0:grade=
‘E‘
;
}
printf
(
"%c"
,grade);
return
0;
}
标签:
原文地址:http://www.cnblogs.com/SSYYGAM/p/4211071.html