Hi, I'm not understanding fully how to go about this, Ive made an analyzer for calculating the mean for temps and i need to have it display the highest temp and on the day that it occurred along with the low temp. If any of you can show and explain it to me it will be greatly appreciated. Thanks. My current code is below, using C.
Code:
int main(void)
{
printf("\n---=== IPC Temperature Analyzer ===---\n");
int low, high, i = 1;
double totalhigh = 0, totallow = 0;
do {
printf("Enter the high value for day %d: ", i);
scanf("%d", &high);
printf("\n");
printf("Enter the low value for day %d: ", i);
scanf("%d", &low);
printf("\n");
if (high > low && high <= 40 && low >= -40) {
i++;
totalhigh += high;
totallow += low;
}
else {
printf("Incorrect values, temperatures must be in the range -40 to 40, high must be greater than low.\n\n");
}
} while (i < 5);
double avgtemp = (totalhigh + totallow) / (NUMS * 2);
printf("The average (mean) temperature was: %0.2lf\n", avgtemp);
return 0;
}