• We hope you have a fantastic holiday season to close out 2025! Thank you all so much for being part of the Tom's Guide community!

Drop lowest score program

Status
Not open for further replies.

laserpp

Distinguished
Nov 29, 2008
137
0
18,630
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
 
Status
Not open for further replies.