I have three functions in this code. One to return the average temperature, one to return the highest value, and another to return the lowest value. Here's my code. Any assistance would be greatly appreciated!
#include <iostream>
using namespace std;
float temptotal = 0;
float averagetemp = 0;
float max = -9999999999999;
float min = 9999999999999;
float days = 0;
float temperatures[50];
void average();
void highest();
void lowest();
int main()
{
cout << "Enter the number of days: ";
cin >> days;
if (days > 50)
{
cout << "You may only enter temperatures for 50 days." << endl;
return 0;
}
void average();
void highest();
void lowest();
for (int i = 1; i <= days; i++)
{
void average(float temperatures[50])
{
cout << "Enter the temperature for day number " << i << ": ";
cin >> temperatures[i];
temptotal += temperatures[i];
averagetemp = (temptotal / days);
cout << "The average temperature is: " << averagetemp << endl;
}
void highest()
{
if (temperatures[i] > max)
max = temperatures[i];
cout << "The highest temperature is: " << max << endl;
}
void lowest()
{
if (temperatures[i] < min)
min = temperatures[i];
cout << "The lowest temperature is: " << min << endl;
}
}
return 0;
}