Advertisement
Infiniti_Inter

с 74 № 20(stack)

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