题解 | #判断成绩等级#
判断成绩等级
http://www.nowcoder.com/practice/1a12e246764243ada9043699b9a1e7ef
三目运算比较方便 #include #include using namespace std; int main() { int score; cin >> score; // write your code here...... string huahua=((score>100)||(score<0))?"成绩不合法": (score>=90)?"优秀": (score>=80)?"良": (score>=70)?"中": (score>=60)?"及格":"差"; cout<<huahua<<endl; return 0; }