请问,问题出在哪里?
#include <iostream>
#include<fstream>
#include<string>
#include<cassert>
using namespace std;
void main()
{
ofstream outfile("file1.txt");
ifstream infile("file2.txt");
assert(outfile);
assert(infile);
string word1;
while(infile>>word1)
{
outfile<<word1;
//cout<<"\n";
}
//cout<<"have no word out"<<endl;
system("pause");
}
上面的代码是在dev—c++中编译的,其中file2.txt 总是创建不了,往file.txt写字符串失败。请问怎样修改才能解决这个问题。