⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ex0316.cpp

📁 practice c++, it is from the book http://www.amazon.com/Schaums-Outline-Programming-John-Hubbard
💻 CPP
字号:
//  Programming with C++, Second Edition, by John R. Hubbard
//  Copyright McGraw-Hill, 2000
//  Example 3.16 on page 47
//  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.\n";
  else if (score >= 90) cout << "Your grade is an A.\n";
  else if (score >= 80) cout << "Your grade is a B.\n";
  else if (score >= 70) cout << "Your grade is a C.\n";
  else if (score >= 60) cout << "Your grade is a D.\n";
  else if (score >=  0) cout << "Your grade is an F.\n";
  else cout << "Error: that score is out of range.\n";
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -