//-------------------------------------------------------------------- // // Example showing the use of the get() function get.cpp // //-------------------------------------------------------------------- // Echoes a sequence of characters until a ! is encountered or the // the number of characters output reaches MAX_COUNT. // This version correctly handles whitespace in the input stream. #include const int MAX_COUNT = 10; void main() { char ch; int count = 0; // Number of characters output cout << endl << "Enter a sequence of characters:" << endl; cin.get(ch); while ( count < MAX_COUNT && ch != '!' ) { cout << ch; count++; cin.get(ch); } }