| 1 | // File: fig0632.cpp |
| 2 | // Computer Systems, Fourth Edition |
| 3 | // Figure 6.32 |
| 4 | |
| 5 | #include <iostream> |
| 6 | using namespace std; |
| 7 | |
| 8 | const int LOWER = 21; |
| 9 | const int UPPER = 65; |
| 10 | |
| 11 | bool inRange (int a) { |
| 12 | if ((LOWER <= a) && (a <= UPPER)) { |
| 13 | return true; |
| 14 | } |
| 15 | else { |
| 16 | return false; |
| 17 | } |
| 18 | } |
| 19 | |
| 20 | int main () { |
| 21 | int age; |
| 22 | cin >> age; |
| 23 | if (inRange (age)) { |
| 24 | cout << "Qualified\n"; |
| 25 | } |
| 26 | else { |
| 27 | cout << "Unqualified\n"; |
| 28 | } |
| 29 | return 0; |
| 30 | } |