/*******************************************************************************
 * Aiden Stannard // CS1A // Chapter 7 Homework: Challange 1# // 10/30/2026
 * 
 * Rainfall Stats
 * 
 * This program recieves 
 ******************************************************************************/
#include <iostream>
using namespace std;

int main()
{
    const int size = 12; // Value for the size of the array
    double year[size]; // array definition
    double large; // stores largest and smallest values assigned to the array
    double small; 
    double totalRain;
    string months[size];
    
    cout << "Enter the total rainfall for the first month of the year: " << endl;
    cin >> year[0];
 
    large = year[0]; 
    small = year[0];
    totalRain = year[0];
    
    for (int count = 1; count < size; count++)
    {
        cout << "Enter the total rainfall for month " << count + 1 << endl;
        cin >> year[count];
        
        while (year[count] < 0) // denies input if negative until a valid number is entered
        {
            cout << "You cannot enter a negative number. Re-enter number: " << endl;
            cin >> year[count];
        }
        
        totalRain += year[count];
        
        if (year[count] > large) // updates the smallest and largest number of the array
            large = year[count];
        if (year[count] < small)
            small = year[count];
    }
    
    cout << "The rainiest month of the year is month " << large << endl;
    cout << "The smallest number in the array is " << small << endl;
    cout << "The total rainfall for the whole year is " << totalRain 
    << " Inches" << endl;
    
    return 0;
}

