I am getting multiple messages referring to
LNK2019: unresolved external symbol "int_cdecl findLowest(int,int)"
referenced in function_main . Whenever I try to compile my program 4 of these messages pop op. I have no idea on how to fix this otherwise I wouldn't be asking for help.
#include <iostream>
using namespace std;
// This program calculates the average of the inputed temperatures and finds the highest and lowest
//
int main()
{
int numOfTemp;
int temp[50];
int pos;
double findAverage(int, int);
int findLowest(int, int);
int findHighest(int, int);
cout << "Please input the number of temperatures to be read (no more than 50)" << endl;
cin >> numOfTemp;
for (pos = 1; pos <= numOfTemp; pos++)
{
cout << "Input temperature " << pos << ":" << endl;
cin >> temp[pos];
}
cout << "The average temperature is " << findAverage(temp[pos], numOfTemp) << endl;
cout << "The lowest temperature is " << findLowest(temp[pos], numOfTemp) << endl;
cout << "The highest temperature is " << findHighest(temp[pos], numOfTemp) << endl;//calls function
}
double findAverage(int table[], int num)
{
for (int i = 0; i < num; i++)
{
int sum = 0;
sum += table[i];
return (sum / num); // calculates the average
}
}
int findLowest(int table[], int num)
{
float lowest;
lowest = table[0]; // make first element the lowest price
for (int count = 0; count < num; count++)
if (lowest > table[count])
lowest = table[count];
return lowest;
}
// This function returns the highest price in the array
int findHighest(int table[], int num)
{
float highest;
highest = table[0]; // make first element the highest price
for (int count = 0; count < num; count++)
if (highest < table[count])
highest = table[count];
return highest;
}