My assignment is to merge two mile into one file. The program run but I keep get
ID: 673053 • Letter: M
Question
My assignment is to merge two mile into one file. The program run but I keep getting a blank screen can anyone help with correcting my program please .
For Example
File 1 File 2 OutputFile
James C Adam B Jame C
Adam B
I need help making correction to my code listed below
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
{
ifstream read1 ("File1.txt");
ifstream read2 ("File2.txt");
ofstream write ("Output.txt");
string line1;
string line2;
read1 >> line1;
read2 >> line2;
while ((!read1, line1, 'n'));
{
if (line1 <= line2)
{
( getline (read1, line1,' ')) ;
write << line1 << endl;
read1 >> line1;
}
else
( getline ( read2, line2, 'n'));
write << line2 << endl;
read2 >> line2;
}
while (!read1.fail())
{
write << line1;
getline (read1, line1);
}
while (!read2.fail())
{
write << line2;
getline (read2, line2);
}
read1.close ();
read2.close ();
write.close ();
return 0;
}