返回列表 發帖
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. queue <int> q;
  4. stack<int> s;
  5. int main()
  6. {
  7.     q.push(1);
  8.     q.push(2);
  9.     q.push(3);
  10.     q.push(4);
  11.     q.push(5);
  12.    
  13.     s.push(1)
  14.     s.push(2);
  15.     s.push(3);
  16.     s.push(4);
  17.     s.push(5);
  18.     s.pop();
  19.     s.pop();
  20.     s.pop();
  21.     s.push(5);
  22.     s.push(4);
  23.     s.push(3);
  24.     while(!q.empty())
  25.     {
  26.         cout<<q.front<<" ";
  27.         q.pop();
  28.     }
  29.     cout<<endl<<"............."<<endl;
  30.     while(!s.empty())
  31.     {
  32.         cout<<s.top()<<" ";
  33.         s.pop();
  34.     }
  35.     return 0;
  36. }
複製代碼

TOP

返回列表