This program should emphasize the use of 2D vectors.
Allow the user to enter values for 2 matrices. You can set a maximum size, but the user gets to determine the actual size. Check for valid multiplication orders and compute the product(s) for display.
Please use good functional decomposition to make your development easier: 2D matrix entry, 2D matrix multiply, 2D matrix display, etc.
Place any matrix functions you develop into a matrix library.
As an example the program interaction might look something like (the parts in blue are typed by the user):
$ matmult.out Welcome to the Matrix Multiplying Program!!! Please enter the size of your first matrix: 40x50 I'm sorry, that matrix is too tall for this program...please reduce the height... Please enter the size of your first matrix: 4x500 I'm sorry, that matrix is too broad for this program...please reduce the width... Please enter the size of your first matrix: 4x5 Thank you, now enter your matrix (row by row): 1 2 2 1 2 1 1 0 1 0 2 2 0 2 0 2 1 2 1 1 Now for the second matrix... Please enter the size of your second matrix: 3x4 Thank you, now enter your matrix (row by row): 1 2 1 2 2 0 2 0 2 2 1 1 Thank you...checking multiplication validities... Your second matrix can be multiplied by your first matrix. No other orderings are valid... When multiplying your 3x4 by your 4x5, you get the 3x5: 9 8 6 7 4 6 8 4 6 4 8 9 6 7 5 Thank you for using the MMP!! Endeavor to have a burgeoning day! $
Note: Recall that for matrix multiplication to be valid, the inner dimensions must match.
This assignment is (Level 3.5).
Add (Level 2) to also search through the transposed matrices for possibly valid multiplications: ~f*~f, ~f*s, ~s*f, ~s*~s, ~s*~f, and ~f*~s. Recall that the transpose of a matrix is formed by flipping along the major diagonal. For example, a 3x5:
9 8 6 7 4 6 8 4 6 4 8 9 6 7 5
Would become a 5x3:
9 6 8 8 8 9 6 4 6 7 6 7 4 4 5
Add (Level 1) to give the user the option of choosing between a pre-counted entry (as above) or an end-detected entry. (Hint: You can detect the end of a row by looking for the '\n' after the last row value. This need only be done for the first row. You can detect the end of the matrix by a blank row being entered -- one with no numbers -- immediately ending in a '\n'.)
Add (Level 1) to make the preceding option automatic instead of by user choice. In other words, you detect from their input whether they are entering the size first or using end-detected entry. (Hint: The size has an 'x' between the values where-as two matrix elements have only space.) (Warning: if their detected row is only one element long, there will be a '\n' instead of an 'x' and it will need to not only discover the entry method but set the row length.)