list0407.cpp

来自「teach yourself C++ in 21 days 第五版」· C++ 代码 · 共 19 行

CPP
19
字号
// Listing 4.7 - demonstrates why braces
// are important in nested if statements
#include <iostream>
int main()
{
   int x;
   std::cout << "Enter a number less than 10 or greater than 100: ";
   std::cin >> x;
   std::cout << "\n";
  
   if (x >= 10)
      if (x > 100)
         std::cout << "More than 100, Thanks!\n";
   else                            // not the else intended!
      std::cout << "Less than 10, Thanks!\n";
  
   return 0;
}

⌨️ 快捷键说明

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