I'm having difficulty displaying the contents of a 2D array like a graph's coordinate system - i.e as standard, [0][0] is displayed in the top left of the output, but I want [0][0] to be displayed at the bottom left.
I have two nested for loops to output the contents of the 2d array to the screen, and I tried reversing the criteria but that puts [0][0] in the bottom right. I think what I need is a way to display a "mirror image" of the default output.
Thanks for the reply. I understand what you mean but it doesnt seem to be working. I'll post the code here:
#include <iostream>
using namespace std;
int main() {
char myArray[4][4];
for (int i = 0; i < 4; i ++) {
for (int j = 0; j < 4; j++) {
myArray[i][j] = '.';
cout << myArray[i][j];
if (j == 3)
cout << endl;
}
}
myArray[0][0] = 'Q';
for (int i = 4; i > 0; i--) {
for (int j = 0; j < 4; j++) {
cout << myArray[i][j];
if (j == 3)
cout << endl;
}
}
return 0;
}
The first output is as desired:
....
....
....
....
But the 2nd input gives me an ASCII symbol for the first line followed by three lines of '.' and there is no sign of the 'Q' at the bottom left location.