Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stack>
- using namespace std;
- void print(stack <int> s)
- {
- while (!s.empty())
- {
- cout << " " << s.top();
- s.pop();
- }
- cout << endl;
- }
- int main(){
- stack <int> s;
- int n;
- for (int i = 0; i < 5; i++)
- {
- cin >> n;
- s.push(n);
- }
- print(s);
- }
Add Comment
Please, Sign In to add comment