You've got those functions to read from input, from file, and make a display.
So far, so good.
I tried to compile it a few times, and it seems that there are a few issues:
-on line 32:
This one only tests the if, then does nothing about it.
That semicolon pretty much makes sure the whole block, that you wished was dependent on the condition, will be executed, whether you like it or not.
Instead remove the ';', and you should have:
cout << "Error reading file \""
return average = -1;
-after the if was solved, there will be no result displayed.
That would be because of line 52:
I am just going to assume that you want to say "if the average is not -1, then display it".
But instead, the not operator '!' will have priority.
So the result inside the if would be:
-if average is anything but 0, then it's always false. It checks whether not-not-zero is equal to -1 (if (0==-1))
-if average is 0, then it checks whether a non-zero is equal to -1 (I do not know what it does next, but it's not as apparently intended).
Here's 2 easy alternatives:
1. set the order of the operators so that you can ask "is it not true that average is equal to -1?", which would look like
2. just use the not-equal operator instead, to ask "is average not equal to/anything but -1?"
Also, this would work with such files like "Filetest1.txt" and not "File test 1.txt", because you're using cin>> as opposed to cin.get() or getline, in case you're not aware. But if you're just to work with 1-word-filenames, then it should be all right.