1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

how to solve matrix in c++ ?

Discussion in 'C++' started by cooop, Aug 9, 2009.

  1. cooop

    cooop New Member

    Joined:
    Jul 8, 2009
    Messages:
    19
    Likes Received:
    0
    Trophy Points:
    0
    A square matrix, that is, one having the same number of rows and columns, A matrix is called a "diagonal" matrix if its only nonzero elements are on the the diagonal. It is called "upper triangular" if all elements below the diagonal are 0, and "lower triangular" if all elements above the diagonal are 0. It is "symmetric" if element i,j is equal to element j,i and "skew symmetric" if element i,j = -element j,i.

    Write a function that accepts a matrix of floats and its dimensions, checks to see if it is square and returns an integer with the proper value according to the following chart:
    Code:
     
                             0              not square
                             1              diagonal  
                             2              upper triangular
                             3              lower triangular
                             4              symmetric
                             5              skew symmetric
                             6              none of the above
     
    The chart also includes precedence; that is, a diagonal matrix is also upper triangular, lower triangular, symmetric and skew symmetric, but the most important property is that it is diagonal so return 1. The zero matrix should be considered diagonal.

    just give me the idea how to do a matrix plz :D
     
  2. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,012
    Likes Received:
    203
    Trophy Points:
    0
    Occupation:
    Senior Support Engineer
    Location:
    England
    Code:
    int matrix[10][10];
    
    defines matrix[0][0] through matrix[9][9] - 100 elements in total for a 10x10 matrix.
     

Share This Page