#ifndef INTRANGE3_H #define INTRANGE3_H #include using namespace std; class IntRange3 { private: int input; // For user input int lower; // Lower limit of range int upper; // Upper limit of range public: // Exception class. class OutOfRange { public: int value; OutOfRange(int i) // Exception class constructor { value = i; } }; // Member functions. IntRange3(int low, int high) // Constructor { lower = low; upper = high; } int getInput() { cin >> input; if (input < lower || input > upper) throw OutOfRange(input); //pass info to the exception handler return input; } }; #endif