void main()
{
int result = 0;
for(int i = 1;i <= 100; ++i)//求和,
result += i;
std::cout<<result<<std::endl;//打印和
char a[10] = {};
itoa(result,a,10);//转字符串
std::cout<<a<<std::endl;//打印字符串
FILE* pf = NULL;
fopen_s(&pf,"result.txt","wb");//创建打开文件
if(!pf)
return;
fwrite(a,1,4,pf); //写入
fclose(pf);//关闭文件
system("pause");
}