📄 ex4_04.cpp
字号:
// Exercise 4.4 Finding the range for an integer.
// This is just a question of bolting sufficent conditional operators together
// in an expression.
#include <iostream>
using std::cin;
using std::cout;
using std::endl;
int main() {
int n = 0;
cout << "Enter an integer: ";
cin >> n;
cout << "The value is "
<< (n<=20 ? "not greater than 20." : (n<=30 ? "greater than 20 and not greater than 30." :
(n<=100 ? "greater than 30 and not exceeding 100.": "greater than 100." )))
<< endl;
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -