Redefinition error on line 76

This was an assignment that is already past due, but I'd like to get it working anyways so I can see what I'm doing wrong. The program is supposed to take in 5 test scores, find and drop the lowest and calculate the average of the remaining 4. Im getting a " redefinition of formal parameter 'lowScore' ", from my line 76 and I have no idea why. I havent gotten this program to compile ever yet, so there could be other potential issues as well.

#include <iostream>
#include <iomanip>

using namespace std;

//Must use:
// void getScore() / store in a reference param variable, should be called once for 5 entered test scores
// void calcAverage() / calculate and display average of 4 highest test scores
// int findLowest() / should find and return lowest score. Called by calcAverage,
// Input validation, no scores lower than 0 or higher than 100

void getScore(int &);
void calcAverage(int, int, int, int, int);
int findLowest(int, int, int, int, int, int);

int main()
{
int score, score1, score2, score3, score4, score5;
cout << "Enter 5 test scores and I will remove the " << endl;
cout << "lowest and average the rest." << endl;

getScore(score1);
getScore(score2);
getScore(score3);
getScore(score4);
getScore(score5);

calcAverage(score1, score2, score3, score4, score5);

system("pause");

return 0;
}

//***********************************
//Definition for getScore function. *
//***********************************

void getScore(int &score)
{
cout << "Enter a score between 0 and 100 " << endl;
cin >> score;
if (score < 0 || score > 100)
{
cout << "Error: Please enter a score from 0 to 100" << endl;
}
else
{
cin >> score;
}
}

//**************************************
//Definition for calcAverage function. *
//**************************************


void calcAverage(int score1, int score2, int score3, int score4, int score5)
{
int lowScore;
double average;
findLowest(score1, score2, score3, score4, score5, lowScore);
average = ((score1 + score2 + score3 + score4 + score5) - lowScore) / 4;
cout << "Your average score is: " << average << endl;
}

//*************************************
//Definition for findLowest function. *
//*************************************

int findLowest(int score1, int score2, int score3, int score4, int score5, int lowScore)
{

int lowScore = score1;

if (score2 < lowScore)
lowScore = score2;
else if (score3 < lowScore)
lowScore = score3;
else if (score4 < lowScore)
lowScore = score4;
else if (score5 < lowScore)
lowScore = score5;

cout << "The lowest test score is: " << lowScore << endl;
return lowScore;
}
1
2
3
int findLowest(int score1, int score2, int score3, int score4, int score5, int lowScore) //Definition
{
int lowScore = score1; //Redefinition 

so how should it be written in order to step through the scores to find the lowest, if I cant assign lowScore to score1? I tried just deleting out that line, but then I get a " uninitialized local variable 'lowScore' in line 64 ". Sshould I be using int (lowScore == score1); ?
Choose another name to avoid name clash.
Topic archived. No new replies allowed.