Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <vector>
- #include <istream>
- #include <ostream>
- #include <stdexcept>
- #include <algorithm>
- using std::cin;
- using std::cout;
- using std::string;
- using std::endl;
- using std::vector;
- using std::istream;
- using std::ostream;
- using std::domain_error;
- using std::sort;
- istream & read_phrase(istream &in, string & phrase) {
- string word;
- if (in)
- {
- phrase.clear();
- while (in >> word && word!="end") {
- phrase += word;
- }
- }
- return in;
- }
- int main()
- {
- string phrase;
- cout << "Enter the phrases" << endl;
- while (read_phrase(cin, phrase)) {
- cout << phrase;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement