queue<int> q;
q.push(7); q.push(8); q.push(9);
cout << q.front() << " " << q.back();
输出的结果是( )。
- A. 9 7:后进先出,front 是最后进来的
- B. 7 9:先进先出——push 从队尾进,front 看队头(最先来的),back 看队尾(最后来的)
- C. 7 7:front 和 back 都指向队头
- D. 编译错误:queue 没有 back 操作
queue<int> q;
q.push(7); q.push(8); q.push(9);
cout << q.front() << " " << q.back();
输出的结果是( )。