Question
2D Array Operations C++Program: Write a modular c++ program thatcreates a two-dimensional integer array initialized with thefollowing data. 2 3 4 1 6 5 6
2D Array Operations C++Program: Write a modular c++ program thatcreates a two-dimensional integer array initialized with thefollowing data.
2 3 4 1 6
5 6 7 8 4
1 5 4 3 2
3 3 4 4 5
See sample partial array set-up with test data using aninitialization list below...or develop your own algorithm
______________________________________________________________________________________________
#include#include #include using namespace std;const int ROW=4,COL=5;//list function prototypes below.... int main(){ int first_array[ROW][COL]={{2,3,4,1,6},{5,6,7,8,4},{1,5,4,3,2},{3,3,4,4,5}}; //array defined with an initialization list int second_array[ROW][COL]; //another array defined but not initialized //your code here...including appropriate function calls return 0;}//function definitions here .........
______________________________________________________________________________________________
The program should have the following functions:
· showArray - This function shouldaccept a two-dimensional array as its argument and display thearray content
· getRandomNumberInput – This functionshould accept a two-dimensional array and fill the array withrandomly generated numbers in the range of 2 through 9 for eachelement in the array. Use the second_array here.
· getTotal - This function shouldaccept a two-dimensional array as its argument and return the totalof all the values in the array.
· getAverage - This functionshould accept a two-dimensional array as its argument and returnthe average of all the values in the array. Display the averagewith a precision of 2.
· getRowTotal – This function shouldaccept a two-dimensional array as its first argument and an integeras its second argument. The second argument should be the subscript(or index) of a row in the array.
The function should return the total of the values inthe specified row.
· getLowestInColumn – This functionshould accept a two-dimensional array as its first argument and aninteger as its second argument. The second argument should be thesubscript (or index) of a column in the array.
The function should return the lowest value in thespecified column in the array.
Demonstrate each of the functions including appropriate callstatements in your program. (Note: points are awarded basedonly on functions that meet the program specifications above andthat your program compiles)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started