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

📄 ex4_02.cpp

📁 这是学习c++的一些编译过的示例,经典的,希望对你有用.
💻 CPP
字号:
// Exercise 4.2 Using nested ifs and a logical && to check the value of an integer.

#include <iostream>
using std::cin;
using std::cout;
using std::endl;
int main() {
  int value = 0;

  cout << "Please enter an integer between 1 and 100: ";
  cin >> value;
  cout << endl;

  if ((value >= 1) && (value <= 100)) {
    if (value > 50)
      cout << "The integer is greater than 50." << endl;
    else if (value < 50)
      cout << "The integer is less than 50." << endl;
    else
      cout << "The integer you entered is 50." << endl;
  }
  else
    cout << "The integer is not between 1 and 100." << endl;

  return 0;
}

⌨️ 快捷键说明

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