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[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?
}

Your example doesn't seem to give enough information to answer this. Your first set of code has a loop using w, but the loop is not acting differently between iterations (probably something in your comment for "some lines of code.")

It seems that you would use the same value as what you had in first (x.to_ulong())

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.