Я получаю множество сообщений, относящихся кЯ получаю множество сообщений, относящихся к LNK2019: неразрешенный внешний символ
LNK2019: неразрешенный внешний символ "int_cdecl findLowest (Int, Int)"
ссылается function_main. Всякий раз, когда я пытаюсь скомпилировать свою программу, 4 из этих сообщений pop op. Я понятия не имею, как это исправить, иначе я не прошу помощи.
#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;
}
Опубликовать сообщения об ошибках, если вы хотите получить помощь – demonplus
Попробовали ли вы объявить свои функции вне 'main()'? –
@demonplus Я отредактировал сообщение в –