# Drop lowest score program

Status
Not open for further replies.

#### laserpp

##### Distinguished
Need help, in my 2nd C++ class and my prof is this 80+ year old guy who shouldnt be teaching and is confusing the hell out of me.

I did this exact program last year and showed this guy and he was like its all wrong. So i tried making it to his liking but I am getting an error and no clue why.

Code:
``````//Jonathan Salina       Lowest Score Drop      6-7

#include <iostream>
using namespace std;

//function prototypes
void getScore();
void calcAverage(int, int, int, int, int);
int findLowest(int, int, int, int, int);

int main()
{

getScore();

return 0;
}

//function to collect the 5 test scores
void getScore(int s1, int s2, int s3, int s4, int s5)
{

cin >> s1;
cin >> s2;
cin >> s3;
cin >> s4;
cin >> s5;

calcAverage(s1, s2, s3, s4, s5);

}

//function to calculate the average of the 4 highest test scores
void calcAverage(int s1, int s2, int s3, int s4, int s5)
{
int average;
int lowest;

lowest = findLowest(s1, s2, s3, s4, s5);

average = ((s1 + s2 + s3 + s4 + s5) - lowest)/4;
cout << endl;
cout << "The average of the four highest test scores is: ";
cout << average << endl;

}

//function to find the lowest test score
int findLowest(int s1, int s2, int s3, int s4, int s5)
{
int lowest = s1;

if (lowest > s2)
lowest = s2;
if (lowest > s3)
lowest = s3;
if (lowest > s4)
lowest = s4;
if (lowest > s5)
lowest = s5;

return lowest;
}``````

the error i am getting is: error LNK2019: unresolved external symbol "void __cdecl getScore(void)" (?getScore@@YAXXZ) referenced in function _main

#### mindless728

##### Distinguished
it's because your function prototype void getScore(void) doesn't match up your function usage void getScore(int,int,int,int,int)

#### mindless728

##### Distinguished
it's because your function prototype void getScore(void) doesn't match up your function usage void getScore(int,int,int,int,int)

#### laserpp

##### Distinguished
Thank you!!! that was the problem

#### Mousemonkey

##### Distinguished
Moderator
This topic has been closed by Mousemonkey

Status
Not open for further replies.
Apps General Discussion 1
Apps General Discussion 0
Apps General Discussion 1
Apps General Discussion 2
Apps General Discussion 10
Apps General Discussion 3
Apps General Discussion 2
Apps General Discussion 3
Apps General Discussion 2
Apps General Discussion 1
Apps General Discussion 1
Apps General Discussion 1
Apps General Discussion 1
Apps General Discussion 5
Apps General Discussion 3
Apps General Discussion 3
Apps General Discussion 1
Apps General Discussion 3
Apps General Discussion 1
Apps General Discussion 6