标题:请高手帮忙看看这道题应该怎么改正错误。
取消只看楼主
happysteven
Rank: 1
等 级:新手上路
帖 子:25
专家分:0
注 册:2010-5-12
结帖率:66.67%
 问题点数:0 回复次数:2 
请高手帮忙看看这道题应该怎么改正错误。
编写程序,将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 编辑 ]
搜索更多相关主题的帖子: 编写程序 include return file 
2010-12-01 21:18
happysteven
Rank: 1
等 级:新手上路
帖 子:25
专家分:0
注 册:2010-5-12
得分:0 
回复 2楼 zhijinwen
不知道怎么做这道题啊,请帮忙,谢谢!
2010-12-01 23:01
happysteven
Rank: 1
等 级:新手上路
帖 子:25
专家分:0
注 册:2010-5-12
得分:0 
回复 4楼 ytchfp
请您帮我改一下可以吗?谢谢!
2010-12-02 09:45



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-327574-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.315121 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved