/* Peter Cline, June 20, CISC105
   Fun with arrays and for loops
   temperature example
*/

#include <stdio.h>
#define NUM_DAYS 10

int main()
{
  double temps[NUM_DAYS] = {88.5, 60, 32, 90.7, 67.8,
                            75.3, 55.2, 85.3, 88.8, 77.7};
  int day = 0;
  double average;
  double sum = 0;
  double max;

  // reading in 10 temperatures into an array
  /*
  printf("Please enter %d temperatures: \n", NUM_DAYS);
  while (day < NUM_DAYS)
    {
      printf(" > ");
      scanf("%lf", &temps[day]);
      day++;
    }
  */

  // printing out those ten temperatures
  printf("Here are your temperatures:\n");
  for (day = 0; day < NUM_DAYS; day++)
    printf("Day %d had temperature %lf\n", day+1, temps[day]);

  // calculate the average
  for (day = 0; day < NUM_DAYS; day++)
    sum += temps[day];
  average = sum / NUM_DAYS;
  printf("Average temperature is: %lf\n", average);

  // calculate the maximum temperature
  max = temps[0];
  for (day = 0; day < NUM_DAYS; day++)
    if (max < temps[day])
      max = temps[day];

  printf("Max temp is: %lf\n", max);

  return 0;
}




