home *** CD-ROM | disk | FTP | other *** search
- // ex10011.cpp
- // The istream get member function
- #include <iostream.h>
-
- main()
- {
- char line[25], ch = 0, *cp;
-
- cout << " Type a line terminated by 'x'\n>";
- cp = line;
- while (ch != 'x') {
- cin >> ch;
- *cp++ = ch;
- }
- *cp = '\0';
- cout << ' ' << line;
-
- cout << "\n Type another one\n>";
- cp = line;
- ch = 0;
- while (ch != 'x') {
- cin.get(ch);
- *cp++ = ch;
- }
- *cp = '\0';
- cout << ' ' << line;
- }