undefined reference to function

My code keeps giving me the same error....undefined reference to 'Function'

I ran into this problem before and when I found the answer before it had to do with the header file.

The top of my code looks like this

using namespace std;

#include <string>
#include <iostream>
#include <fstream>


struct Tide
{
string date;
string time;
float height;
};

void getData(string , Tide [], Tide [], Tide [], string& , string& );
void maxMinMean ( Tide [], double&, double&, double& );



the part that is giving me problems is this..

maxMinMean( lowDataList, lowMax, lowMin, lowMean );

maxMinMean ( highDataList, highMax, highMin, highMean );


the low and high have to do with low tide and high tide, not that it matters.



here is the function...



void maxMinMean( Tide list[], double max, double min, double mean )
{
max = 0;
min = 1000000000;
double numOfRecords = 0;
double totalHeight = 0;

for(int N = 0;N < (sizeof(list)/sizeof(Tide));N++)
{
if (list[N].height > max) max = list[N].height;

if (list[N].height < min) min = list[N].height;

totalHeight+= list[N].height;
numOfRecords++;
}

mean = totalHeight/numOfRecords;
}

you have forgotten to add the & for max,min and mean when you define the parameters of the function

1
2
3
4
void maxMinMean( Tide list[], double& max, double& min, double& mean )
{
max = 0;
Topic archived. No new replies allowed.