Guest User

Untitled

a guest
Dec 15th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. #include <iostream>
  2. #include <stack>
  3. using namespace std;
  4.  
  5. void print(stack <int> s)
  6. {
  7. while (!s.empty())
  8. {
  9. cout << " " << s.top();
  10. s.pop();
  11. }
  12. cout << endl;
  13. }
  14.  
  15. int main(){
  16. stack <int> s;
  17. int n;
  18.  
  19. for (int i = 0; i < 5; i++)
  20. {
  21. cin >> n;
  22. s.push(n);
  23. }
  24.  
  25. print(s);
  26. }
Add Comment
Please, Sign In to add comment