Array and input\output files

I am new to c++ and this website, so I will try to do this correctly. My problem is to take two input files from the user, not knowing how many integers exist on the two files, and create an output file with the largest, smallest, and average of the numbers from the two files. I know I have to use an array, but don't know exactly how. Thanks. Here is what I have so far:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <string>
using namespace std;

int main ()
{
    cout<<"Please enter the first file name for the data you would like to be calculated\n";
    string in_file, in_file2, out_file;
    cin>>in_file;
    cout<<"Please enter the second file name for the data you would like to be calulated\n";
    cin>> in_file2;
    cout<<"I will find the largest, smallest, and the average of the numbers from these two files and write them to an output file. Please enter the name of the file you would like these values to be output to.\n";
    cin>> out_file;
    
    ifstream in_stream, in_stream2;
    ofstream out_stream;
    
    in_stream.open(in_file);
      if (in_stream.fail())
      {
          cout<<"Input file opening failed.\n";
          exit(1);
      }
    
    in_stream2.open(in_file);
      if (in_stream2.fail())
      {
          cout<<"Input file opening failed.\n";
          exit(1);
          
      }
    
    out_stream.open(out_file);
      if (out_stream.fail())
      {
          cout<<"Output file opening failed.\n";
          exit(1);
      }
    

    
    
    
}
Topic archived. No new replies allowed.