I have to put the following block of code in a loop. It is to display a 10x10 array that will hold char values for a message encrypted in a transposition cipher.
I have not been able to figure out a loop or a system of loops that can do this. I need to do the loop for 10x10, 5x20, and 4x25, and 2x50. The snippet below is for 10x10, but if I can figure out how to do it for 10x10, I imagine it should be easy to do the other array dimensions too.
cout << e[0][0]
<< e[0][1] << e[1][0]
<< e[0][2] << e[1][1] << e[2][0]
<< e[0][3] << e[1][2] << e[2][1] << e[3][0]
<< e[0][4] << e[1][3] << e[2][2] << e[3][1] << e[4][0]
<< e[0][5] << e[1][4] << e[2][3] << e[3][2] << e[4][1] << e[5][0]
<< e[0][6] << e[1][5] << e[2][4] << e[3][3] << e[4][2] << e[5][1] << e[6][0]
<< e[0][7] << e[1][6] << e[2][5] << e[3][4] << e[4][3] << e[5][2] << e[6][1] << e[7][0]
<< e[0][8] << e[1][7] << e[2][6] << e[3][5] << e[4][4] << e[5][3] << e[6][2] << e[7][1] << e[8][0]
<< e[0][9] << e[1][8] << e[2][7] << e[3][6] << e[4][5] << e[5][4] << e[6][3] << e[7][2] << e[8][1] << e[9][0]
<< e[1][9] << e[2][8] << e[3][7] << e[4][6] << e[5][5] << e[6][4] << e[7][3] << e[8][2] << e[9][1]
<< e[2][9] << e[3][8] << e[4][7] << e[5][6] << e[6][5] << e[7][4] << e[8][3] << e[9][2]
<< e[3][9] << e[4][8] << e[5][7] << e[6][6] << e[7][5] << e[8][4] << e[9][3]
<< e[4][9] << e[5][8] << e[6][7] << e[7][6] << e[8][5] << e[9][4]
<< e[5][9] << e[6][8] << e[7][7] << e[8][6] << e[9][5]
<< e[6][9] << e[7][8] << e[8][7] << e[9][6]
<< e[7][9] << e[8][8] << e[9][7]
<< e[8][9] << e[9][8]
<< e[9][9];
Btw, this is in Dev-C++. Any help greatly appreciated :cheesy: