Write a C-Sharp code to make a “Matrix”. User must be asked to enter the following information: Size of the matrix and values. The program must compute the following operations:
1. sumMatrix (return the sum of all the values of array)
2. averageMatrix (return the average of all the values of array)
3. shiftRowUp (shifts all of the rows of the matrix upward)
4. shiftColumnRight (shift all the columns of the matrix rightward)
5. Reverse a row/column (Reverse the user specified row/ column)
6. Mirror row/ column (Check the user specified row/ column to be a mirror)
7. Exit the Program
Use another class “testClass” which makes object of the above Matrix class in the main function to get inputs and show all the outputs on screen

5 Years
Discussion Span
Last Post by thines01

i know it is a homework, i don't know how to shift rows and columns ( question no 3 , 4 )
thanx for reply


To shift rows you do this:

Take row 1 and copy it to row 0.
Take row 2 and copy it to row 1.
Take row 3 and copy it to row 2.
take row n-1 and copy it to row n-2.
Take row n and copy it to row n-1.

The questions you need to ask is "What do I put in row n? What happens to row 0?"

Shifting columns is the same.


A question I have (as Momerath implied):
Would a "rotate" be counted as a "shift"?

Also, does it matter if you re-draw or re-create the matrix when a shift occurs?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.