/* testutils.cpp CIS 150 2008-06-17 David Klick Driver program used to demonstrate the use of the utils150.h library. */ #include #include "utils150.h" using std::cout; using std::cin; using dgk::getInt; using dgk::getDouble; void cont(); int main(int argc, char* argv[]) { int n = 0; double x = 0.0; n = getInt("Please enter an integer", -10, 20); cout << "You entered " << n << "\n\n"; x = getDouble("Please enter a floating point number", -10.276, 20); cout << "You entered " << x << "\n\n"; cont(); return 0; } /* void cont(); Arguments: none Returns: nothing Clears input buffer and pauses waiting for user to press Enter. */ void cont() { if (cin.rdbuf()->sungetc() != -1 && cin.get() != '\n') cin.ignore(80,'\n'); cout << "Press enter to continue..."; cin.get(); }