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