say i have an array of size 4
and this is what i want to to...
tmp[0][0].id is initialized to [0].id
if tmp[0][0].id = a[1].id
tmp[0][1].id = a[1].id
if it isnt true go to next statement
tmp[1][0].id = a[1].id
then next loop
if tmp[0][0].id = a[2].id
tmp[0][2].id = a[2].id
if it isnt true
if tmp[1][0].id = a[2].id
tmp[1][1].id = a[2].id
if it isnt true
tmp[2][0].id = a[2].id
then next loop
if tmp[0][0].id = a[3].id
tmp[0][3].id = a[3].id
if it isnt true
if tmp[1][0].id = a[3].id
tmp[1][2].id = a[3].id
if it isnt true
if tmp[2][0].id = a[3].id
tmp[2][1].id = a[3].id
if it isnt true
tmp[3][0].id = a[3].id
how would i go about doing this for an array with size N?
this is the idea for the code i have so far... wrote on paper syntax is not correct
y is the size of the array
Code:int z = 1; for(int x=0;x<y;x++) { for(z;z<y;z++) { if(tmp[x][x].id = a[z].id; tmp[x][z].id = a[z].id; } else tmp[z][x].id = a[z].id } }



LinkBack URL
About LinkBacks


