使用数组和函数时如何避免"未定义引用..."?

0 c++ arrays reference

我正在学习如何通过制作执行以下操作的程序将数组用作函数参数:

  1. 从用户获取四个测试分数并将其存储在数组中
  2. 计算数组中得分的总和
  3. 从总和中减去最低的测试分数,并给出调整后的总和
  4. 计算调整后的总和的平均值,并打印出平均值

我在一本名为"用c ++开始"的书中找到了这个程序.我似乎已经按照它提供的源代码来解决这个问题,但是发生了错误,我不明白问题出在哪里.

这是我不完整的源代码:(我正在使用代码块)

错误出现在第20行:

对'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];
    }
}
Run Code Online (Sandbox Code Playgroud)

那我怎么解决这个问题呢?

Gun*_*ele 6

double GetTotal(const double[], int);
double GetLowest(const double[], int);
Run Code Online (Sandbox Code Playgroud)

这些函数没有正文,它们没有在任何地方定义.你需要这两个函数的源代码.