新手抄的一段代码 求解惑
#include <iostream>
#include <fstream>
#include <string>
int main()
{
ofstream outfile( "out_file" );
ifstream infile( "in_file" );
if ( ! infile ) {
cerr << "error: unable to open input file!\n";
return -1;
}
if ( ! outfile ) {
cerr << "error: unable to open output file!\n";
return -2;
}
string word;
while ( infile >> word )
outfile << word << ' ';
return 0;
}
这段代码有什么问题啊,编译一下都是错误。。求解答