Click here to Skip to main content
15,917,971 members

Comments by Member 12985257 (Top 2 by date)

Member 12985257 22-Mar-17 17:27pm View    
Thanks everyone, I now know where the mistake come from.
Member 12985257 22-Mar-17 12:33pm View    
Sorry for not explaining clearly on the problem. When we created a nested loop, if let say the size = 2; with this code:
for ( int i = 0; i < size ; i++)
{ for ( int j = 0; j < size ; j++)
{ for ( int k = 0; k < size; k++)
{ cout << i << j << k << endl;



count++;
}

}

}

Output will be:
000
100
010
110
001
101
011
111

But, what I want is something like this, where the index value is stored into an array.
Element X[] Y[] Z[]
1 0 0 0
2 1 0 0
3 0 1 0
4 1 1 0
5 0 0 1
6 1 0 1
7 0 1 1
8 1 1 1