简体   繁体   English

为什么在 c++ 的调试控制台中的 vs 代码中打印了数字?

[英]Why in vs code in the debug console for c++ is there numbers being printed?

I am printing a maze and it works but sometimes this number comes up or maybey a few, this is the code en_route is a 2d array of bools我正在打印一个迷宫,它可以工作,但有时会出现这个数字,或者可能有几个,这是代码 en_route 是一个 2d 布尔数组

    std::cout << std::endl;
    std::cout <<".";
    for(int j=0;j<y;j++,std::cout<<".\n.")
        for(int i=0;i<x;i++)
            if(en_route[i][j])      std::cout << "*";
            else                    std::cout << " ";
    std::cout << std::endl;

odd circle with number in code代码中有数字的奇数圈

also unrelated this 2 or another number shows up later on any idea?也无关这 2 或其他数字后来出现在任何想法上?

.**********.
.*****  ***.
.***    ***.
2
.       *  .
.       ** .
. ***  *** .
.** ****** .
.*  *******.
.** *    **.
.

As written in the comments.正如评论中所写。 This is not an output, but the same line was output twice in a row, so it is displayed together on the display side.这不是 output,而是同一行是 output 连续两次,所以在显示侧一起显示。
Since it is twice, "2" is displayed.因为是两次,所以显示“2”。
Using the "Terminal" instead of the "Debug Console" will solve the problem.使用“终端”而不是“调试控制台”将解决问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM