C++编程?

来源:百度知道 编辑:UC知道 时间:2024/06/06 05:19:30
#include<iostream.h>
#include<fastream.h>

main(int argc,char*argc[])
{char ch;
if(argc!=3){
cout<<"Bad command!/n";
return 0;}
ifstream in(argc[1]);
if(!in)
{
cout<<"cannot open source file ";
return 0;
}
ofstream out(argc[2]);
if(!out)
{
cout<<"cannot open target";
return 0;
}
while(in.get(ch))
{
out.put(ch);
cout<<ch;
}
in.close();
out.close();
return 1;
}
请高手帮一下,怎样改啊!
错误:cpp(2) : fatal error C1083: Cannot open include file: 'fastream.h': No such file or directory

#include<iostream.h>
#include<fstream.h>

int main(int argv,char* argc[])
{
char ch;
if(argv!=3){
cout<<"Bad command!/n";
return 0;}
ifstream in(argc[1]);
if(!in)
{
cout<<"cannot open source file ";
return 0;
}
ofstream out(argc[2]);
if(!out)
{
cout<<"cannot open target";
return 0;
}
while(in.get(ch))
{
out.put(ch);
cout<<ch;
}
in.close();
out.close();
return 0;
}

//fastream改为fstream
//应该为int main(int argv,char* argc[])
//return 0而不是return 1;

写错了吧,fastream.h应该是fstream.h