This repository has been archived on 2024-12-16. You can view files and clone it, but cannot push or open issues or pull requests.
CodeBlocksPortable/WATCOM/samples/cplbexam/iostream/istream/peek.cpp

17 lines
379 B
C++
Raw Permalink Normal View History

#include <iostream.h>
void main( void ) {
char ch, nch;
cout << "Enter a string:" << endl;
while( ( ch = cin.get() ) != '\n' ) {
if( ch != '/n' ) {
cout << "Extracted character: " << ch << endl;
}
if( ( nch = cin.peek() ) != '\n' ) {
cout << "Next character will be extracted: " << nch << endl;
}
}
}