//OrinTill Qimid CS1A Chapter 4, P. 294, 4
//
/**************************************************************
* Calculate Rainfall
*
* ____________________________________________________________
* This program will display the highest and the lowest rain fall with the average rain fall
* ____________________________________________________________
* INPUT
* rainfall : rainfall per month
*
* OUTPUT
* highest : highest number of rain fall
* lowest : lowest number of rainfall
* Average : average number of rainfall
* total_rainfall : total number of rainfall
**************************************************************/
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main()
{
const int ARRAY_SIZE = 12;
double rainfall[ARRAY_SIZE];
float total_rainfall;
float average;
float highest;
float lowest;
lowest = 1000000000.0;
highest = 0.0;
total_rainfall = 0.0;
for (int i = 0; i < 12; i++)
{
cout<<"Please enter the amount of rain fall for month "<<i+1<<endl;
cin>>rainfall[i];
total_rainfall +=rainfall[i];
if (lowest > rainfall[i])
{
lowest = rainfall[i];
}
if (highest<rainfall[i])
{
highest = rainfall [i];
}
}
average = total_rainfall/12;
cout<<"the total amount of rainfall is "<<total_rainfall<<endl;
cout<<"the average rainfall is "<<average<<" highest rainfall is "<<highest<<" lowest rainfall is "<<lowest<<endl;
return 0;
}