Please send questions to
st10@humboldt.edu .
/*--------------------------------------------------
created by smtuttle at Tue Apr 27 23:36:09 PDT 2010
--------------------------------------------------*/
#include <iostream>
#include <cmath>
using namespace std;
/*--------------------------------------------------
Contract: get_max : double[] int -> double
Purpose: expects an array of amounts and its size, and produces
the largest amount in that array
Examples: for:
const int NUM_READINGS = 4;
double skunk_readings[NUM_READINGS] = {15, 100, 850, 250};
get_max(skunk_readings, NUM_READINGS) == 850
--------------------------------------------------*/
double get_max(double amounts[], int num_amounts)
{
double max_so_far = amounts[0];
for (int i=0; i<num_amounts; i++)
{
if (max_so_far < amounts[i])
{
max_so_far = amounts[i];
}
}
return max_so_far;
}