down to one error, hints anyone?

//**************************************************
// Stephen Patterson
// COP2000.C01
// Project 5: Lowest Score Drop
// this program will open a file named grades.txt,
// (a list of test grades) drop the lowest score,
// and calculate the average
//**************************************************
#include <iostream>
#include <fstream>
#include <iomanip>
using namespace std;

//Function prototypes
int getScore(int &score);
int calcAverage(int score1, int score2, int score3, int score4, int score5, int min, float& average);
int findLowest(int, int, int, int, int, int);
void testFile(ifstream& inFile);
void openFile(ifstream& inFile);
void display(float average);

int main ()
{
//variables
ifstream inFile; //input file
int score1; //first input number from the file
int score2; //second input number from the file
int score3; //third input number from the file
int score4; //fourth input number from the file
int score5; //fifth input number from the file
int min = 0;
float average = 0.0;

//open the file
openFile(inFile);

//test if file opened properly
testFile(inFile);

//get input values from the file
getScore(score1);
getScore(score2);
getScore(score3);
getScore(score4);
getScore(score5);

//perform calculation
calcAverage(score1, score2, score3, score4, score5, min, average);

//display the answer
display(average);
}

//FUNCTION DEFINITIONS

/*****************************************
**openFile will open the input file for reading
******************************************/
void openFile(ifstream& inFile)
{
inFile.open("grades.txt");
}
/********************************************
** testFile will ascertain the file open properly
*********************************************/
void testFile(ifstream& inFile)
{
if (!inFile)
{
cout << "Error opening input file" << endl;
exit (2000); //stops the program
}
}
/****************************************************
** getScore will read one value from the input file
*****************************************************/
int getScore(istream& inFile)
{
int score;
inFile >> score;
return score;
}
/******************************************************************************
** calcAverage will compute the answer based on the highest scores
******************************************************************************/
void calcAverage (int score1, int score2, int score3, int score4, int score5, int min, float average)
{
findLowest(score1, score2, score3, score4, score5, &min);
average = (((score1 + score2 + score3 + score4 + score5) - min) / 4.0);
}
/********************************************************************
** findLowest will determine the lowest score in grades.txt
*********************************************************************/
int findLowest(int score1, int score2, int score3, int score4, int score5, int min)
{
min = score1;
if (score2 < min)
min = score2;
else if (score3 < min)
min = score3;
else if (score4 < min)
min = score4;
else if (score5 < min)
min = score5;

cout << "The lowest test score is " << min << endl;

return min;
}
/****************************************************************
** display will show the answer on the console screen
****************************************************************/
void display(float average)
{
cout << "The average is: " << average << endl << endl;
}
So what's the error?

Also, use code tags.

[code]
put your code in here
[/code]
Last edited on
This function call is invalid

findLowest(score1, score2, score3, score4, score5, &min);

The function is declared as

int findLowest(int, int, int, int, int, int);

I think you meant

int findLowest(int, int, int, int, int, int &);

and the corresponding call as


findLowest(score1, score2, score3, score4, score5, min);
Topic archived. No new replies allowed.