// Exercise 3
//
// Write a function to return the maximum value from a
// std::vector<double>
//

#include <iostream>
#include <vector>

// Get the maximum value in a 
double max(std::vector<double> v) {
  double max = v[0];
  for (int i=1; i < v.size(); i++) {
    if (v[i] > max) {
      max = v[i];
    }
  }
  return max;
}

// Test program
int main(int argc, char** argv)
{
  std::vector<double> x(6);
  x[0] = 4.3;
  x[1] = 1.2;
  x[2] = 5.7;
  x[3] = 9.1;
  x[4] = 0.2;
  x[5] = 3.3;
  double y = max(x);
  std::cout << y << "\n";
}
