#include#includeusing namespace std;int main() {queue q;q.push(1);//会将一个元素a置入队列q中(尾插法)q.push(2);q.push(3);cout << "队列第一个元素值:" << q.front() << endl;cout << "队列最后一个元素值:" << q.back() << endl;cout << "移除第一个元素" << endl;q.pop();cout << "第一个元素的值:" << q.front() << endl;cout << "队列中元素个数为:" << q.size() << endl;cout << "队列是否为空:" << q.empty() << endl;return 0;}
测试结果: