c++ - Error Compiling simple program Error LNK2019 -
error 1 error lnk2019: unresolved external symbol "int __cdecl findlowest(int,int,int,int,int)" (?findlowest@@yahhhhhh@z) referenced in function _main g:\c++\chapter 6\lowest score drop\lowest score drop\source.obj lowest score drop
#include <iostream> #include <iomanip> using namespace std; //function prototypes void getscore(int &score); int findlowest(int, int, int, int, int); void calcaverage(int, int, int, int, int, int); int lowest = 0; int main() { int score1, score2, score3, score4, score5; getscore(score1); // return 1st score getscore(score2); // return 2nd score getscore(score3); // return 3rd score getscore(score4); //return 4th score getscore(score5); //return 5th score lowest = findlowest(score1, score2, score3, score4, score5); calcaverage(score1, score2, score3, score4, score5, lowest); return 0; } void getscore(int &score) { (int count = 1; count <= 5; count++) { cout << "please enter test score test " << count << ": "; cin >> score; } } int findlowest(int score1, int score2, int score3, int score4, int score5) { int calclowest = score1; { if (score2 < score1) calclowest = score2; else if (score3 < score2) calclowest = score3; else if (score4 < score3) calclowest = score4; else if (score5 < score4) calclowest = score5; } cout << "the lowest test score " << calclowest << endl; return calclowest; } void calcaverage(int score1, int score2, int score3, int score4, int score5, int lowest) { int average; average = ((score1 + score2 + score3 + score4 + score5) - lowest)/4; cout << "the average of 4 highest scores " << average << endl; }
you have typographical error when wrote definition of function findlowest
.
int findlowest(int score1, int score2, int score3, int score4, int score5)
the l
in findlowest
in upper case forward declaration , function call has l
in lower case.
int findlowest(int, int, int, int, int); lowest = findlowest(score1, score2, score3, score4, score5);
Comments
Post a Comment