W3School TIY Editor

  • W3School 在线教程
  • 改变方向
  • 暗黑模式
​x
 
#include <iostream>
#include <deque>
using namespace std;
​
int main() {
  deque<string> cars = {"Volvo", "BMW", "Ford", "Tesla"};
​
  // 移除首元素
  cars.pop_front();
​
  // 移除尾元素
  cars.pop_back();
  
  // 打印双端队列元素
  for (string car : cars) {
    cout << car << "\n";
  }
​
  return 0;
}