Question: Write a function that returns the sum of all the elements in a specified column in a 2D array or 2D vector (which the screenshot
Write a function that returns the sum of all the elements in a specified column in a 2D array or 2D vector (which the screenshot below refers to as a matrix). Test the function from main by prompting the user to enter in a 3 x 4 matrix, row by row. Use nested loops to iterate over the 2D array. Enter a 3-by-4 matrix row by row: 1.5 2 34 Enter 5.5 6 7 8Ent 9.5 1 3 1 Enter Sum of the elements at column 0 is 16.5 Sum of the elements at column 1 is 9 Sum of the elements at column 2 is 13 Sum of the elements at column 3 is 13 Your program should also: Use constants where appropriate. . Use appropriate datatypes for representing the program information . Use comments for documentation purposes Use proper indentation and code structure Use meaningful, descriptive variable names
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
