can't get code to output to a file

I have to make up a fucntion that passes an array of int and it's size then only prints out numbers above average from one file to another and i think i got it to work mostly but its not outputting any thing any thoughts ?

Here is what I have so far

#include <iostream>
#include <fstream>
using namespace std;
void over_average(int array[7], int size, ofstream& outstream);
int main() {
ifstream inStream; ofstream outStream;
int array[7];
inStream.open("TextFile1.txt");
if (inStream.fail())
{
cout << "ERROR: Failed to open input \n"; exit(-1);
}
outStream.open("Output.txt");
if (outStream.fail()){ cout << "ERROR: Failed to open input \n"; exit(-2);
}
over_average(array, 7, outStream);
inStream.close();
outStream.close();
return 0;
}
}
The problem most likely is in over_average().
Last edited on
would you suggest removing the line of code all together, or change it ?
The line where you call over_average() is correct, but I think there's a mistake in the function itself. Could you post it's code?
over_average(int array[7], int size, ofstream& outstream);
I mean the body of over_average() :)
Topic archived. No new replies allowed.