ex0216.cpp
来自「practice c++, it is from the book http:/」· C++ 代码 · 共 21 行
CPP
21 行
// Programming with C++ by John R. Hubbard
// Copyright McGraw-Hill, 1999
// Example 2.16 on page 38
// Using the else if construct
#include <iostream>
using namespace std;
int main()
{ // prints the grade for an input test score:
int score;
cout << "Enter your test score: "; cin >> score;
if (score > 100) cout << "Error: that score is out of range.";
else if (score >= 90) cout << "Your grade is an A." << endl;
else if (score >= 80) cout << "Your grade is a B." << endl;
else if (score >= 70) cout << "Your grade is a C." << endl;
else if (score >= 60) cout << "Your grade is a D." << endl;
else if (score >= 0) cout << "Your grade is an F." << endl;
else cout << "Error: that score is out of range.";
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?