Reputation: 1
I'm learning how to use arrays as funtion arguments by making a program that does the following:
I found this program in a book called "starting out with c++" I seem to have followed the source code it provides to solve this problem but and error occurs and I don't understand where the problem is.
Here is my incomplete source code: ( I am using code blocks )
The error appears in line 20 :
undefined reference to 'GetTotal(double const*, int)'
#include <iostream>
#include <iomanip>
using namespace std;
void GetScores(double[], int);
double GetTotal(const double[], int);
double GetLowest(const double[], int);
int main()
{
const int SIZE = 4;
double scOres[SIZE],//array holds scores
total, // to store total test scores
lowestScore, // to store lowest test score
average;// to store average value
GetScores(scOres , SIZE); //gets test scores from user
GetTotal(scOres , SIZE); //sums up test scores
GetLowest(scOres , SIZE); //gets lowest score
return 0;
}
void GetScores(double scores[],int size)
{
for (int index = 0; index < size; index++)
{
cout << "Enter test score " << index + 1 << ":" ;
cin >> scores[index];
}
}
Upvotes: 0
Views: 2251
Reputation: 524
double GetTotal(const double[], int);
double GetLowest(const double[], int);
These functions don't have a body, they are not defined anywhere. You'll need the source code of those two functions.
Upvotes: 6