// FILE: charlie.cc //PURPOSE: To show how to input a line of characters one character at a time // and what you get as a result. #include // required for EXIT_FAILURE etc #include #include int main() //Pre: Waits for user to input a line of text and then // Post: A line of cin is written to cout as integers. // The last character processed from cin is ; // the last character written to cout is code for . // unless the cin is terminated by end of file(eof) { // Local data ... const char nwln = '\n'; // newline character char next_ch; // inout: character buffer // Stop the input skipping newline and space characters cin >> resetiosflags(ios::skipws); //hidden in Chapter 8. // Copy all data characters from cin file stream to cout file stream. cin >> next_ch; while ( (next_ch != nwln) && !cin.eof ()) { cout <> next_ch; } // end while if(!cin.eof()) cout <