My friend and I were working on developing code for this but we have no idea if this is right. This is what we have so far...
Code:
#include <iostream>
#include <string>
#include <fstream>
#include <sstream>
#include <cstdlib>
#include <vector>
#include <list>
int main(int argc, char argv[])
{
using namespace std;
ifstream in_stream1;
ofstream out_stream;
ifstream in_stream2;
in_stream1.open("prob2list1.txt");
in_stream2.open("prob2list2.txt");
out_stream.open("prob2merged.txt");
int num1;
int num2;
int i;
int j;
int mergeList[10000];
while(in_stream1.eof!=0)
{
in_stream1>>num1;
mergeList[i]= num1;
i++;
}
while(j<i)
{
in_stream2>>num2;
if(mergeList[j]>num2)
j++;
else
{
if(j==0)
{
mergeList.insert(j,1);
mergeList[0]=num2;
}
else
{
mergeList.insert(j,1);
mergeList[j-1]=num2;
}
j++;
}
}
return 0;
}
Line 30 - Error:Invalid use of member<did you forget the &?>
Line 46 - Error:Request for member 'insert' in 'mergeList', which is of non-class type 'int[10000]'
Line 51 - Error:Request for member 'insert' in 'mergeList', which is of non-class type 'int[10000]'
I know this code probably won't do the job in the first place and so any assistance would be greatly appreciated,thanks.











Linear Mode
