Question
Write a program that receives m and n as the number of rows and columns of a matrix, respectively. Then it follows by m lines
Write a program that receives m and n as the number of rows and columns of a matrix, respectively. Then it follows by m lines of input from the user, each referring to n integers in each row of the matrix. The program then continuously reads commands from user and performs different operations based on users command. Users command will be one of the following: ? T: Transpose - rows become columns (and vice versa) and prints the result matrix. ? R: RowMultiply - multiplies all values in each of the rows and prints the results in one line, separated by space. ? C: ColumnMin - finds the smallest value in each of the columns and prints the results in one line, separated by space. ? Q: Quit - stops reading commands from the user. If user enters one of the first three commands, the operation should be applied to the original matrix. The result of each operation is either printing a new matrix (if the command is T) or printing the result of calculating RowMultiply or ColumnMin in one line (if the command is R or C). Please note that each of the T, R, and C commands should be applied to the original matrix (not on the matrix that results from the most recent operation). If user selects the quit option by entering Q, it terminates the program execution. It will be a good practice if you implement R, C, and T operations using separate methods.
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