954,505 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

matrix multiplication help..

Write a program that creates a two dimension matrix of size N x N (N is larger than 4). Through a menu, the user can choose to perform the following operation to the matrix.

1 - Rotate the matrix around the diagonal (function name rotateDiagonal)

Example for 3 x 3 matrix :

1 2 3 - 1 4 7
4 5 6 - 2 5 8
7 8 9 - 3 6 9

2 - Rotate the matrix around the middle row (function name rotateRow)

1 2 3 - 7 8 9
4 5 6 - 4 5 6
7 8 9 - 1 2 3

3 - Rotate the matrix around the middle column (function name rotateColumn)

1 2 3 - 3 2 1
4 5 6 - 6 5 4
7 8 9 - 9 8 7

4 - Set the upper triangle to zero (function name setUpperZero)


1 2 3 - 1 0 0
4 5 6 - 4 5 0
7 8 9 - 7 8 9

Write your program such that the user enters the values of the matrix, and each operation of the above is performed by a function as indicated above. Use the (switch) structure to call the functions.

The user menu can be as follows

1 - Enter Matrix Values
2 - Rotate around Diagonal
3 - Rotate around the middle row
4 - Rotate around the middle column
5- Set the upper triangle to zero

Enter your option ?


we cant seem to start with this program..
we seek help from C language experts in sorting out this problem and has the know-how knowledge to get us onto the right track..
please do help us..

mr_maverix
Newbie Poster
1 post since Sep 2007
Reputation Points: 10
Solved Threads: 0
 

So when do you get to choose 'N' ?
- at compile time
- at run time

Salem
Posting Sage
Team Colleague
11,531 posts since Dec 2005
Reputation Points: 5,862
Solved Threads: 953
 

> please do help us.
Help yourself by creating at least a skeleton program. Draw a flow chart on paper to get you started and use google for help...

iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439
 

pls try to come down with ur programming for the of the beginners.

febiri peter
Newbie Poster
1 post since Dec 2011
Reputation Points: 10
Solved Threads: 0
 

your going to use 2 dimensional arrays

Don't expect someone here to give you the immediate answer
try coding your work and we'll help you if you have any problems

zeroliken
Veteran Poster
1,106 posts since Nov 2011
Reputation Points: 201
Solved Threads: 162
 

Setting the upper right triαng£e to 0 :

// a[ ][ ] is the 2-D matrix..

for( i=0 ; i < n ; i++ )
for( j=0 ; j < n ; j++ )
{
if( j > i )
a[ i ][ j ]=0;
}

Eg :
1 0 0 0
5 6 0 0
9 0 4 0
8 9 6 1

mridul.ahuja
Newbie Poster
17 posts since Oct 2010
Reputation Points: 2
Solved Threads: 1
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You