赞
踩
/************************************************************************* > File Name: ex5.6.cpp > Author: > Mail: > Created Time: Sun 11 Feb 2024 10:38:22 AM CST ************************************************************************/ #include<iostream> #include<vector> using namespace std; int main(){ vector<string> scores = {"E", "D", "C", "B", "A", "A++"}; string lettergrade; int grade; cout<<"Enter Grade: "; cin>>grade; lettergrade = (grade < 60) ? scores[0] : scores[(grade - 50) / 10]; if(grade != 100 && grade >= 60){ (grade % 10 > 7) ? lettergrade += '+' : (grade % 10 < 3) ? lettergrade += '-' : } cout<<"Grade: "<<lettergrade<<endl; return 0; }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。