Using fstream

Hey you guys, once again I need your forever greatful advise. I'm stuck getting this program to run. I tried differnt approaches to invoke the statement but none seems to work. Help.

#include <iostream>
#include <fstream>
using namespace std;

void ReadAndSum(ifstream&, int&, float&);
// Reads two integer values from a file. But from which file?????

int main ()
{
ifstream dataFile;
int numberOfValues;
float average;

cout.setf(ios::fixed, ios::floatfield);
cout.setf(ios::showpoint);

dataFile.open("shell4.dat");


// FILL IN the invoking statement for ReadAndSum:Tthis is where I get stuck at...



cout << "The average of " << numberOfValues
<< " values is " << average << endl;
return 0;
}
You have to supply the file (that is what the ifstream is, it is a file). Read this for more info on fstreams:

http://www.cplusplus.com/doc/tutorial/files/
Topic archived. No new replies allowed.