1 #include<iostream>
2 #include<stack>
3 #include<deque>
4 using namespace std;
5
6
7 int main()
8 {
9 stack<int> first;
10 cout << "size of first: " << first.size() << endl;
11
12 for (int i=0; i<6; i++)
13 first.push(i);
14 cout << "size of first: " << first.size() << endl;
15
16 while( !first.empty() )
17 {
18 cout<<first.top()<<' ';
19 first.pop();
20 }
21 cout<<endl;
22
23 deque<int> deq(10,0);
24 stack<int> second( deq );
25 cout << "size of second: " << second.size() << endl;
26 while( !second.empty() )
27 {
28 cout<<second.top()<<' ';
29 second.pop();
30 }
31 cout<<endl;
32
33 return 0;
34 }
2 #include<stack>
3 #include<deque>
4 using namespace std;
5
6
7 int main()
8 {
9 stack<int> first;
10 cout << "size of first: " << first.size() << endl;
11
12 for (int i=0; i<6; i++)
13 first.push(i);
14 cout << "size of first: " << first.size() << endl;
15
16 while( !first.empty() )
17 {
18 cout<<first.top()<<' ';
19 first.pop();
20 }
21 cout<<endl;
22
23 deque<int> deq(10,0);
24 stack<int> second( deq );
25 cout << "size of second: " << second.size() << endl;
26 while( !second.empty() )
27 {
28 cout<<second.top()<<' ';
29 second.pop();
30 }
31 cout<<endl;
32
33 return 0;
34 }