So far, I have only read about using void functions to take on ifstreams as a parameter. Yet I want to be able to make a single function that takes a file of numbers as a parameter, and do some calculation to each number. I can do this with a void function pretty easily, but I want a separate the calculations and the opening of the file. How do I do this?
for an example Ill show you these prototypes.
void average( ifstream& file_in);
//doesnt work to my knowledge
int average(ifstream& file_in);
Ps I am away from my computer with my code, and my compiler.
No arrays please I havent learned that yet!