Hi,
I need your help please..I am given the following data and I need to write C++ commands to get the array filled...
a[source][destination]=some value

how to write C++ code for the following? loop condition can be used
a[0][0]=0;
a[0][1]=1;
a[0][2]=1;
a[0][3]=1;
a[0][4]=3;
a[0][5]=2;
a[0][6]=3;
a[0][7]=3;

Recommended Answers

All 4 Replies

Member Avatar for iamthwee

Where is your code to get the random number?

I wrote the above array from A routing table..I need the code to write in C++? Loop syntax can be used

Does it matter what you put in the array?

If not, why not just fill it with the same number (e.g. - 1, 5, 19, etc. - whatever you like.)

Or you could fill the array with some permutation of the indices of the array elements themselves. For example,

a[i][j] = i*j; OR
a[i][j] = i + j; OR
a[i][j] = 3*i + 7.9*j; OR
whatever permutation you'd like.
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.