// Determine the minimum and maximum values in an array
#include <iostream>

int main ()
{
  const int n=10; // number of elements in the array
  double temperature[n] = { 23.5, 32.8, 33.9, 31.3, 26.9,
                            21.3, 19.4, 23.7, 26.9, 31.6 };
  double min, max;

  // initialise min and max as the value of the first element
  min = max = temperature[0];

  for (int i=1; i<n; i++) {
    if ( temperature[i] < min ) min = temperature[i];
    if ( temperature[i] > max ) max = temperature[i];
  }

  std::cout << "minimum temperature is " << min << std::endl;
  std::cout << "maximum temperature is " << max << std::endl;

  return 0;
}
