【发布时间】:2021-08-29 08:41:07
【问题描述】:
如果您编译并运行此代码,则不会执行 endl。当您将终端弹出全屏时,您将得到 0hello。
#include <iostream>
int main() {
using namespace std;
for (int i = 0; i < 15; i++) {
cout << '\t';
}
cout << "0" << endl << "hello";
return 0;
}
但是,如果您使用cout << "00" << endl << "hello";,那么它可以正常工作。我不明白为什么会发生这种情况,也不知道如何解决。
【问题讨论】:
-
无法复制。
hello按我的预期出现在新线路上(godbolt 也是) -
请问什么操作系统和编译器?
-
Windows 10 和我使用 ms visual studio