12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- #include <iostream>
- int main()
- {
- using std::cout;
- using std::cin;
- using std::endl;
- char ch;
- while(cin.get(ch))
- {
- if (ch != '#')
- cout << ch;
- else
- {
- cin.putback(ch);
- break;
- }
- }
- if (!cin.eof())
- {
- cin.get(ch);
- cout << endl << ch << " is next input character.\n";
- }
- else
- {
- cout << "End of file reached.\n";
- std::exit(0);
- }
- while(cin.peek() != '#')
- {
- cin.get(ch);
- cout << ch;
- }
- if (!cin.eof())
- {
- cin.get(ch);
- cout << endl << ch << " is next input character.\n";
- }
- else
- cout << "End of file reached.\n";
- return 0;
- }
|