CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2011
    Posts
    7

    Matrix generation in C++

    0
    down vote

    I have the following code:

    for (int w=0; w<10; w++)
    {
    //some lines of code
    unsigned long num = x.to_ulong();
    cout << "Decimal form is: " << num << endl;
    }
    Now what I want is, to make a matrix which will have these values of num, column wise. For example, matrix[i][j], where i is from, let's say "0 to 15", and "j" is from "0 to 15" as well. I want them to put like, matrix[0][0], then matrix[0][1], matrix[0][2] and so on, something like:

    for(int i=0; i<=15; i++)
    {
    for(int j=0; j<=15; j++)
    matrix[i][j] = num //here is problem, value of "num" what shall i write instead of it?
    }

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Matrix generation in C++

    Quote Originally Posted by blessed87 View Post
    ...
    Code:
    for(int i=0; i<=15; i++)
    {
        for(int j=0; j<=15; j++)
            matrix[i][j] = num //here is problem, value of "num" what shall i write instead of it?
    }
    Well you are the only one who knows which value should be assigned to the matrix in the row/column [i][j]
    Victor Nijegorodov

Tags for this Thread

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured