| 1 | // File: fig0640.cpp |
| 2 | // Computer Systems, Fourth Edition |
| 3 | // Figure 6.40 |
| 4 | |
| 5 | #include <iostream> |
| 6 | using namespace std; |
| 7 | |
| 8 | int main () { |
| 9 | int guess; |
| 10 | cout << "Pick a number 0..3: "; |
| 11 | cin >> guess; |
| 12 | switch (guess) { |
| 13 | case 0: cout << "Not close"; break; |
| 14 | case 1: cout << "Close"; break; |
| 15 | case 2: cout << "Right on"; break; |
| 16 | case 3: cout << "Too high"; |
| 17 | } |
| 18 | cout << endl; |
| 19 | return 0; |
| 20 | } |
| 21 |