于墨轩 • 27天前
#include <iostream>
using namespace std;
int main() {
int score;
cin >> score;
if (score >= 90) {
cout << "A" << endl;
} else if (score >= 70) {
cout << "B" << endl;
} else if (score >= 60) {
cout << "C" << endl;
} else {
cout << "D" << endl;
}
return 0;
}
#include <iostream>
using namespace std;
int main() {
int score;
cin >> score;
int tens = score / 10;
switch(tens) {
case 9:
cout << "A" << endl;
break;
case 7:
case 8:
cout << "B" << endl;
break;
case 6:
cout << "C" << endl;
break;
default:
cout << "D" << endl;
break;
}
return 0;
}
评论: