
Chapter 10: Prelab Assignment
User-Defined Data Types | 233
Name __________________________________________ Date _______________________
Section _________________________________________
Exercise 1: Program Gauge reads int values and converts them to the appropriate constant in an
enumeration type. The constants in the enumeration type are used as the case labels in a switch
statement that controls which message is printed.
// Program Gauge inputs pressure readings from file gauge.dat
// and writes appropriate messages.
#include <iostream>
#include <fstream>
using namespace std;
enum DecisionType {ERROR, NORMAL, HIGH, EVACUATE};
DecisionType GetPressure(ifstream&); ...