cpp
#include <iostream>
#include <fstream>
using namespace std;
int main() {
double myNumber = 42.5;
fstream outfile("test.txt", fstream::out);
outfile << "The answer is almost " << myNumber << endl;
outfile.close();
}
运行之后未能找到相应的test.txt文件
解决:
选择顶栏中的Product->Scheme->Edit Scheme->Options->Working Directory勾选Use custom working directory->下面的地址栏选择项目地址。