LAB 07D - TRANSPOSE IT

Concepts

If you've taken linear algebra, then you know what the transpose of a matrix is. If not, that's OK, as the concept is pretty simple. Basically the transpose of a matrix is a new matrix where the rows become the columns and the columns become the rows (a reflection). See Wikipedia for more details.

Get Started

Changing the size of an array is easier to do when the numbers of rows and columns are specified as symbolic constants; otherwise the change requires modifications to several statements. Thus, to get started, create two global constants NROWS and NCOLS which are assigned the values 4 and 2, respectively.

Then, in your main() function, declare a 2D array that is of size NROWS and NCOLS.

Transpose It!

In this lab, create the following four functions. Three of the four functions should have one parameter, a 2D array of size NROWSxNCOLS; the transpose function also needs a 2nd 2D array parameter, of size NCOLSxNROWS.

In summary, your main function should:

  1. call the read 2D array to input matrix values
  2. call the print 2D array function with the matrix read in
  3. call the transpose function with both the matrix read in and the matrix that will hold the transposed elements
  4. call the print 2D array function with the transposed matrix
NOTE: This lab will be due with Homework 07 (due Friday Mar 11 at 8am).