Results 1 to 3 of 3

Thread: matrix with static method

  1. #1
    OrtizCooper is offline Banned
    Join Date
    Dec 2009
    Posts
    186
    Rep Power
    0

    Default matrix with static method

    Calculating identity matrix with static method in C

    I wanted to make a static method for calculating the identity matrix of the order n in the C. how can I build this identity matrix using the static method. I know to create an identity matrix using simple methods. Any idea would be highly appreciated.

  2. #2
    CarterWatson is offline Senior Member
    Join Date
    Dec 2009
    Posts
    189
    Rep Power
    3

    Default

    1) For creating a matrix in c its very simple either you can use the in built C functions or you can just use the code which I have given below:

    class Matrix
    {
    float matrix [rows][columns];

    }

    This code will create a matrix of the order rows X columns which you will indicate
    FYI rows=number of rows you would like in your matrix
    columns=number of columns you would like in your matrix

  3. #3
    MoralesWard is offline Senior Member
    Join Date
    Dec 2009
    Posts
    176
    Rep Power
    3

    Default

    2) Try the following code shown below which is resolving your problem.

    void matrix()
    {
    int count = 0;
    printf("\Insert the matrix ");
    for(i = 0; i <= 2; i++)
    for(j = 0; j <= 2; j++)
    scanf("%d", &a[i][j]);

    for(i = 0; i <= 2; i++)
    {
    for(j = 0; j <= 2; j++)
    {
    if(i <= j)
    {
    if(a[i][j] == 0)
    count++;
    }
    }
    }
    if(count == 3)
    printf("This is upper triangular Matrix\n");
    else
    printf("This is not an upper triangular Matrix\n");
    }

    int main()
    {
    matrix();
    }

Similar Threads

  1. Method to act Internet Security
    By LewisClark in forum General Internet Terms
    Replies: 0
    Last Post: 08-20-2010, 02:12 PM
  2. Page load method in asp.net
    By HernandezOrtiz in forum Programming
    Replies: 2
    Last Post: 04-27-2010, 01:34 PM
  3. override ToString() method in C#
    By Devante Swann in forum Programming
    Replies: 2
    Last Post: 02-24-2010, 11:24 AM
  4. The easy method to Set Up a Mac Airport
    By Isaac Johnson in forum Wireless Networking
    Replies: 1
    Last Post: 01-02-2010, 06:53 AM
  5. How to test the Ram on Your PC (The simple method!)
    By Franklin Macallum in forum Motherboards & Memory
    Replies: 0
    Last Post: 12-21-2009, 09:01 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
SEO by SubmitEdge

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48