#14053. [GESP202609 六级 C++] 第 4 题

[GESP202609 六级 C++] 第 4 题

下列代码执行后的输出结果是( )。

stack<int> s;
queue<int> q;
for (int i = 2; i <= 6; i += 2) {
  s.push(i);
  q.push(i);
}
s.pop();
q.pop();
cout << s.top() << " " << q.front();

{{ select(1) }}

  • 2 4
  • 4 4
  • 4 6
  • 6 2