CPP
cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include<iostream>
#include<stack>
using namespace std;
int main(){
stack<int> s;
for (auto& num : {10, 100, 5, 99, 20}) {
s.push(num);
}
s.push(66);
while (!s.empty()) {
cout << s.top() << endl;
s.pop();
}
return 0;
}
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run