please answer all questions You need to generate a (5x12) rain matrix (Rain[5][12]) that contains the average rainfall over 12 months for a 5 year period. You program should do the following steps: 1) Create a 5x12 integer rainfall matrix 2) Create a 5 element array of int pointers(int * Rain[5]) and assign each pointer to the address of the first element of each row 3) Populate the elements of the matrix with pseudo-random numbers having a range from 0-100 inches. Use the rand( ) function to generate your temperatures. The output of rand() should be mod with 100 (rand()%100) in order to get reasonable rainfall values. Init the random number generator with long seed = srand(67) This task should be performed by a function, void RainGen(int* Rain[ ], int R, int C), that populates all the matrix entries. 4) After generating all rainfall matrix entries, print the entire matrix using the function, void Print(int* Rain[ ], int R, int C); 5) Calculate the total monthly Rainfall per year for the entire five years. Use the following function, int Year(int * Rain[], int C); 6) Print the total yearly sum 7) Calculate the total monthly rainfall for the entire five years by using the following function, int Month(int *ptr, int R, int C); Where ptr = &Rain[0][0] 8) Print the total
please answer all questions
You need to generate a (5x12) rain matrix (Rain[5][12]) that contains the average rainfall over 12 months for a 5 year period. You program should do the following steps:
1) Create a 5x12 integer rainfall matrix
2) Create a 5 element array of int pointers(int * Rain[5]) and assign each pointer to the address of the first element of each row
3) Populate the elements of the matrix with pseudo-random numbers having a range from 0-100 inches. Use the rand( ) function to generate your temperatures. The output of rand() should be mod with 100 (rand()%100) in order to get reasonable rainfall values.
- Init the random number generator with long seed = srand(67)
- This task should be performed by a function, void RainGen(int* Rain[ ], int R, int C), that populates all the matrix entries.
4) After generating all rainfall matrix entries, print the entire matrix using the function, void Print(int* Rain[ ], int R, int C);
5) Calculate the total monthly Rainfall per year for the entire five years. Use the following function, int Year(int * Rain[], int C);
6) Print the total yearly sum
7) Calculate the total monthly rainfall for the entire five years by using the following function, int Month(int *ptr, int R, int C);
- Where ptr = &Rain[0][0]
8) Print the total
Step by step
Solved in 4 steps with 3 images