Hello. I am asking for help. I have 2 input files containing sorted integers. These 2 have to be concatenated into a third file and now all the integers must be sorted. (Example: file1 contains 1 5 8, file2 - 2 3 6 and file3 must contain 1 2 3 5 6 8 ). How can this be accomplished? Thanks in advance. Here's what I have done so far:
#include <iostream>
#include <stdlib.h>
#include <fstream>
using namespace std;
int main(int argc, char *argv[])
{
int n;
ifstream f1;
f1.open(argv[1]);
if (f1.fail())
{ cout << "Error opening " << argv[1] << endl; return 1; }
ifstream f2;
f2.open(argv[2]);
if (f2.fail())
{ cout << "Error opening " << argv[2] << endl; return 1; }
ofstream f3;
f3.open(argv[3]);
f1.close();
f2.close();
f3.close();
return 0;
}