Write a program that works with monthly rainfall data for a particular city. This program uses the monthly rainfall measured in inches for a period of 12 months ( ex, for Oct. 2011 - Sept. 2012).
The data is to be read from a data file into parallel arrays (month, year, and rainfall) that can each hold 12 values. Your arrays should be declared in main. DO NOT declare your arrays globally. You must pass the arrays to functions. Write a function to perform the input. Use the following data to test your program:
1) After the data is input the program computes and prints the average monthly rainfall using all 12 rainfall values. Write a function to compute and return the average.
2) The program also computes how much each actual monthly rainfall is above or below the average. The program should use another array of 12 difference values to store the results. Write a function to perform this computation and save the results in the new array.
3) Now that you have this second array, you can easily compute the standard deviation for the rainfall data. The concept of standard deviation and how it is computed will be discussed in class. Write a function to compute and return the standard deviation (you might want to break this task into several functions.
4) Output a labeled, formatted table showing the rainfall for each of the 12 months (convert month numbers to strings for output, month 10 should print as October) as well as how much above or below average the rainfall was for each of these months. Write a function to display this data.
here is my program
#include <iostream>
#include <fstream>
using namespace std;
double avg(double rainfall[]);
void getinput (int [], int [],double []);
double difference (double rainfall [], double average []);
int main()
{
ifstream instream;
int month[12], year[12];
double rainfall[12];
double differences[12];