这段c++代码为什么执行结果是图片所示??

#include<stdio.h>
#include<string.h>
#include<string>
#include<queue>
using namespace std;


const int maxn=100;

struct Node {
    int x;
    int y;
    int step;
};

queue<Node> q22;


int main() {

    Node node;
    node.x=12;
    node.y=13;
    node.step=14;
    q22.push(node);
    Node top=q22.front();
    q22.pop();
    printf("%d\n",top.step);

}

代码可以直接复制运行。

clipboard.png

正确的运行结果不是输出 step=14 吗,为什么会输出这个大的一个数字??

阅读 1.7k
1 个回答

应该是14,并且我跑了下你代码,是14

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题