I cannot find a problem within the code. My highest, average, and total come out to be the correct number. My lowest number comes out to be around negative two million every time. Please help. Thank you!
// Practice 31.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <string>
using namespace std;
int main()
{
const int SIZE = 12;
double rainfall[SIZE];
int lowest = rainfall[0];
int highest = rainfall[0];
double total = 0;
for (int i = 0; i < 12; i++) {
cout << "Enter rainfall for month " << i + 1 << endl;
cin >> rainfall[i];
if (rainfall[i] < 0) {
cout << "Please enter a postive number" << endl;
cin >> rainfall[i];
}
}
for (int i = 1; i < SIZE; i++) {
if (rainfall[i] < lowest) {
lowest = rainfall[i];
}
if (rainfall[i] > highest) {
highest = rainfall[i];
}
}
for (int i = 0; i<SIZE;i++){
total += rainfall[i];
}
double average = total / SIZE;
cout << "The total amount of rainfall is "<< total << endl;
cout << "The average amount of rainfall is "<< average << endl;
cout << "The highest amount of rainfall is "<< highest << endl;
cout << "The lowest amount of rainfall is " << lowest << endl;