Problem description Enter a percentile score T, convert it to the corresponding level, the specific conversion rules are as follows:
90~100 is A;
80~89 is b;
70~79 is C;
60~69 is D;
0~59 to E;
Input
There are multiple sets of input data, one for each group, and an integer.
Output
For each set of input data, output one line. If the input data is not in the 0~100 range, output one line: "Score is error!".
Sample Input
5667100123
Sample Output
Edascore is error! Code implementation:
1#include <stdio.h>2 intMain ()3 {4 intA;5 while(SCANF ("%d", &a)! =EOF)6 {7 if(a<0|| A> -) printf ("score is error!\n");8 Else9 Switch(ATen)Ten { One Case Ten: A Case 9:p rintf ("a\n"); Break; - Case 8:p rintf ("b\n"); Break; - Case 7:p rintf ("c\n"); Break; the Case 6:p rintf ("d\n"); Break; - default:p rintf ("e\n"); - } - } + return 0; -}
1.switch ()
Case *:*;
Case *:*;
default:*;
Note that the expression transformation in switch () is noted in the statement, as well as the effect of case 10 and break;
hdoj2004-Score Conversion