请高手帮忙看看这道题应该怎么改正错误。
编写程序,将abc.txt的内容复制到xyz.txt文件中。谢谢高手帮助!#include<fstream>
#include<iostream>
using namespace std;
int main()
{
ofstream out;
out.open("D:\\abc.txt");
if(!out)
{
cout<<"Can't open output file"<<endl;
return 0;
}
out<<9<<endl;
out.close();
return 0;
ifstream in("D:\\abc.txt");
if(!in)
{ cout<<"Can't open input file"<<endl; return 0; }
int i;
in.read((char*)&i, sizeof(int));
cout<<i<<endl;
in.close();
return 0;
ofstream out1;
out1.open("D:\\xyz.txt");
if(!out1)
{
cout<<"Can't open output file"<<endl;
return 0;
}
out1<<i<<endl;
out1.close();
return 0;
}
[ 本帖最后由 happysteven 于 2010-12-1 22:38 编辑 ]