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/conistrm.cpp

19 lines
366 B
C++
Raw Permalink Normal View History

#include <iostream.h>
class mystream : public istream {
public:
mystream ( istream &is ) : ios ( is ), istream ( is ) {};
};
void main( void ) {
char ch;
mystream test ( cin );
// CRTL-Z is used to mark an EOF
cout << "Enter a string (press CRTL-Z):" << endl;
while( (test >> ch).good() ) {
cout << ch << flush;
}
}