Advertisement
Infiniti_Inter

с74 № 20(list)

Apr 11th, 2019
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.37 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. #include <list>
  5. #include <fstream>
  6.  
  7. using namespace std;
  8.  
  9.  
  10. int main()
  11. {
  12.     list<string> words;
  13.     fstream in("input.txt", ios::in);
  14.     while (in.peek() != EOF) {
  15.         string s;
  16.         in >> s;
  17.         words.push_front(s);
  18.     }
  19.     list<string>::iterator it = words.begin();
  20.     while (it != words.end()) {
  21.         cout << *it << endl;
  22.         it++;
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement