/* DemoIO.cpp CIS 150 David Klick May 2008 This program demonstrates simple C++ I/O. */ #include using std::cin; // used for input using std::cout; // used for output using std::endl; void cont(); int main() { // declare variables int n; double x; char c; // get user input cout << "Enter an integer: "; cin >> n; cout << "Enter a floating-point number: "; cin >> x; cout << "Enter a single character: "; cin >> c; // display results cout << "You entered " << n << ", " << x << ", " << c << endl; cont(); return 0; } void cont() { if (cin.rdbuf()->sungetc() != -1 && cin.get() != '\n') cin.ignore(80,'\n'); cout << "Press enter to continue..."; cin.get(); }