【发布时间】:2023-07-12 20:07:01
【问题描述】:
我想打印数字并在它们之间放置一个空格,但在编译之后我注意到我将 + 运算符留在了那里(C# 练习)。当我运行这个程序时,它立即停止工作,但文本文件中有一个非常奇怪的输出。为什么文本文件是这样的?
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
int i=0;
ofstream f("out.txt");
while(i != -1)
{
f << " " + i++;
}
return 0;
}
551Kb 文件中的一些行:
deleted virtual method called
eleted virtual method called
leted virtual method called
eted virtual method called
ted virtual method called
ed virtual method called
d virtual method called
virtual method called
virtual method called
irtual method called
rtual method called
tual method called
ual method called
al method called
l method called
method called
method called
ethod called
thod called
hod called
od called
d called
called
called
alled
lled
led
ed
d
【问题讨论】: