daily pastebin goal
21%
SHARE
TWEET

Untitled

a guest Dec 15th, 2018 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top