these are the error message that i'm getting:Code:#include <iostream> #include <fstream> #include <cassert> using namespace std; void ReadAndSum(ifstream& dataFile, int& numberOfValues, float& average); // Reads, counts, and averages the integers stored in a file int main () { ifstream dataFile; int numberOfValues; float average; cout.setf(ios::fixed, ios::floatfield); cout.setf(ios::showpoint); dataFile.open("Shell4.dat"); assert(dataFile.is_open()); //check to make sure file opened if (dataFile.fail()) { cout<<"Input file opening failed.\n"; exit(1); } //dataFile >> num1 >> num2; ReadAndSum(dataFile, numberOfValues, average) cout << "The average of " << numberOfValues << " values is " << average << endl; dataFile.close(); return 0; } //*************************************** void ReadAndSum(ifstream& dataFile, int& numberOfValues, float& average); { double next; while (dataFile>>next) { cout<<next<<endl; } }
error C2146: syntax error : missing ';' before identifier 'cout'
error C2447: missing function header (old-style formal list?)
what am i doing wrong? any help with this is greatly appreciated!
thanks!



LinkBack URL
About LinkBacks


