946 - I2P(II)2016_Yang_Lab5 Scoreboard

Time

2016/04/22 13:30:00 2016/04/22 14:50:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
10994 Matrix class test

10994 - Matrix class test   

Description

Create a class Matrix to represent an N x N matrix.

Provide public member functions that perform or derive:

  1. Interchanging two rows.
  2. Rotating Matrix by 90° clockwise.
  3. Rotating Matrix by 90° counter clockwise.
  4. Checking if Matrix is symmetric or not. If yes, print “yes”, otherwise, print “no”.

Hint:

  • Symmetric

A matrix A = (aij) is symmetric if its entries are symmetric with respect to the main diagonal, that is, aij = aji, for all indices i and j.

The following 3 x 3 matrix is symmetric:

1 7 3

7 4 -5

3 -5 6

 

Note:

1.  This problem involves three files.

  • function.h: Class definition of Matrix.
  • function.cpp: Member-function definitions of Matrix.
  • main.cpp: A driver program to test your class implementation.

You will be provided with function.h and main.cpp, and asked to implement function.cpp.

function.h

main.cpp

2. For OJ submission:

       Step 1. Include function.h into function.cpp and then implement your function.cpp. (You don’t need to modify function.h and main.cpp)

       Step 2. Submit the code of function.cpp into submission block.

       Step 3. Check the results and debug your program if necessary.

Input

The first line has an integer N (2<=N<=50), which means the size of the matrix. The total number of elements in the matrix is thus N x N.

For the next N lines, each contains N integers, specifying the elements of the matrix.

The last line has two integers, which mean two row indices for performing row exchange.

All of the integers in the same line are separated by a space.

Output

Your program should print the corresponding results, and each is followed by a new line character.

Sample Input  Download

Sample Output  Download

Partial Judge Code

10994.cpp

Partial Judge Header

10994.h

Tags

10402Contest



Discuss