Question
Write a C program that is able to view, add, or multiply two matrices input by the user. After inputting the two matrices, the user
Write a C program that is able to view, add, or multiply two matrices input by the user. After inputting the two matrices, the user should be presented with a menu of possible operations View the matrices Add the matrices Multiply the matrices Quit the program The user should be able to make a choice, see the outcome of the operation, and then make another choice from the menu. The program should continue to operate in this manner until the user selects the quit action, at which point the program should exit. 1. Collect user input for two matrices The size of each matrix in rows and columns The data stored in the matrices The user should be able to input up to a 5x5 matrix. Your program should be able to support any size up to a 5x5 (e.g. 2x3, 1x2, 4x4, 5x3, etc). The matrices should hold double type floating point numbers and be stored in a single or multidimensional array. 2. Display a menu of available options that includes, at least, the following View the matrices Add the matrices Multiply the matrices Quit the program The program should loop indefinitely until the user selects the option to quit. Each time an operation is selected, your program should perform the selected operation, display the results, and then present the user with the menu again. 3. The results of the performed operation should only be displayed and not stored, meaning they should not affect the values of the matrices input by the user. Thus performing the same operation repeatedly will return the same results. 4. Before performing an operation, you must ensure that the operation is valid. If the user has input matrices which are not compatible with the selected operation, print an error message indicating the problem and then present them with the menu again. Do not simply quit the program.
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