要求写一个程序接受用户输入两个数字,求和后将这一过程写入一个文本文件中。要怎么写呀。为什么我写出来后,只能看到要我输入两个数字,但看不到那个文件。不是很懂,感谢回答。
收起
如下:
#include<iostream> #include<fstream> using namespace std; int main(void) { int i,j; cout << "请输入两个整数:" << endl; cin >> i >> j; ofstream OutFile("Test.txt"); OutFile << i << " + " << j << " = " << i+j << endl; OutFile.close(); return 0; }
报告相同问题?