// Castulo Jason Quintero CSC5 Chapter 5 homework, pg. 294 #3
//
/**************************************************************************
* List of Rising Ocean Levels
* ________________________________________________________________________
*
* This program will calculate and display the rise
* in ocean levels in millimeters over the next 25 years.
* ________________________________________________________________________
* INPUT
* years : Number of years calculated
*
* OUTPUT
* oceanLevel : Ocean levels each year
*
*************************************************************************/
#include <iostream>
#include <iomanip>
using namespace std;
int main ()
{
const int MIN_YR_VALUE = 1, // Minimum years that will be calculated
MAX_YR_VALUE = 25; // Maximum years that will be calculated
const float INCREMENT = 1.5; // Rise amount per year
float oceanLevel; // Ocean level rise after each year
int year; // Year variable
// Set table formatting
cout << fixed << setprecision(2);
cout << "Ocean Level Rise Over Next 25 Years\n\n";
cout << "Year\t Ocean Level Per Year\n";
cout << "----------------------------\n";
// Initialize variable
oceanLevel = INCREMENT;
// Initiate for loop/accumulate years
for (year = MIN_YR_VALUE; year <= MAX_YR_VALUE; year++)
{
cout << year << "\t\t\t\t" << oceanLevel << "mm" << endl; //Display
oceanLevel += INCREMENT;
}
return 0;
}