another c++ program
#include"iostream"
#include"fstream"
using namespace std;
#include"fstream"
using namespace std;
int main()
{
ifstream fin1,fin2;
ofstream fout;
char next;
char if_name1[15],if_name2[15],of_name[15];
{
ifstream fin1,fin2;
ofstream fout;
char next;
char if_name1[15],if_name2[15],of_name[15];
cout<<"Please enter the name of the first infile"<<endl;
cin>>if_name1;
fin1.open(if_name1);
if(fin1.fail())
{
cout<<"Can not open the infile "<<if_name1<<endl;
exit(1);
}
cout<<"please enter the name of the outfile"<<endl;
cin>>of_name;
fout.open(of_name);
if(fout.fail())
{
cout<<"Can not open the outfile "<<of_name<<endl;
exit(1);
}
while(!fin1.eof())
{
fin1.get(next);
fout<<next;
}
cin>>if_name1;
fin1.open(if_name1);
if(fin1.fail())
{
cout<<"Can not open the infile "<<if_name1<<endl;
exit(1);
}
cout<<"please enter the name of the outfile"<<endl;
cin>>of_name;
fout.open(of_name);
if(fout.fail())
{
cout<<"Can not open the outfile "<<of_name<<endl;
exit(1);
}
while(!fin1.eof())
{
fin1.get(next);
fout<<next;
}
fin1.close();
fout.close();
cout<<"please enter the name of the second infile"<<endl;
cin>>if_name2;
fin2.open(if_name2);
if(fin2.fail())
{
cout<<"Can not open the infile "<<if_name2<<endl;
exit(1);
}
fout.close();
cout<<"please enter the name of the second infile"<<endl;
cin>>if_name2;
fin2.open(if_name2);
if(fin2.fail())
{
cout<<"Can not open the infile "<<if_name2<<endl;
exit(1);
}
fout.open(of_name,ios::app);
while(!fin2.eof())
{
fin2.get(next);
fout<<next;
}
while(!fin2.eof())
{
fin2.get(next);
fout<<next;
}
fin2.close();
fout.close();
cout<<"Succeed"<<endl;
return 0;
}
fout.close();
cout<<"Succeed"<<endl;
return 0;
}