Im having problem with this code I made for finding the average rain fall. When the program starts. it is suppose to go through each month and you are able to input the rainfall. When the months show up in the CMD it is just a bunch of numbers and letters. I believe the array is set up right. maybe im missing something.
# include <iostream>
# include <cstring>
using namespace std;
int main ()
{ double avgRain = 0;
double rainSum = 0;
int count = 0;
int monthlyTotals[12];
string monthNames[] = {"January","Febuary","March","April","May","June","July","August","September","October","November","December"};
cout << "Please enter the amount of rainfall for each month, and press enter after each: " << endl;
for (count = 0; count <= 12; count++)
{
cout << monthNames << " : ";
cin >> monthlyTotals[count];
}
for (count =0; count <=12; count++)
rainSum = rainSum + monthlyTotals[count];
avgRain = rainSum / 12;
for (count = 0; count <=12; count++)
{
cout << "Output : " << endl;
cout << monthNames << "\t" << monthlyTotals[count] << endl;
}
cout << rainSum << "is the total rainfall for the year\n" << avgRain << " is the average for the year.\n";
return 0;
}
if anything else is noticed to be wrong or could be done better. plz reply.