Advertisement
fsimen

Untitled

Oct 25th, 2014
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4. #include <istream>
  5. #include <ostream>
  6. #include <stdexcept>
  7. #include <algorithm>
  8.  
  9. using std::cin;
  10. using std::cout;
  11. using std::string;
  12. using std::endl;
  13. using std::vector;
  14. using std::istream;
  15. using std::ostream;
  16. using std::domain_error;
  17. using std::sort;
  18.  
  19. istream & read_phrase(istream &in, string & phrase) {
  20. string word;
  21. if (in)
  22. {
  23. phrase.clear();
  24. while (in >> word && word!="end") {
  25. phrase += word;
  26. }
  27. }
  28. return in;
  29. }
  30.  
  31. int main()
  32. {
  33. string phrase;
  34.  
  35. cout << "Enter the phrases" << endl;
  36. while (read_phrase(cin, phrase)) {
  37. cout << phrase;
  38. }
  39. return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement