Hey guys I cannot get my array value to align to the right.
I do not know what I am doing wrong, I just can never seem to get the numbers to align, even with other projects.
And yes I am using <iomanip>.
I tried placing the "right" in front of setw(), removing "right" and leaving setw() by itself,I set setw() as setw(5) and it just makes the program look even more weird.
I know the code is not wrong its just that small glitch.
I want the output of the array to look like this:
1 45 765 6
32 45 12 389
100 1 9 50
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
void displayArray(int numArray[][COLS])
{
cout << "Here is the data in the 2-Dimensional array: \n";
for (int i = 0; i < ROWS; i++)
{
for (int j = 0; j < COLS; j++)
{
cout << setw(2) << right << "\t" << numArray[i][j];
}
cout << endl;
}
}
It did not work, it only created a bigger gap in between.
1 2 3 4 5 6 7
Enter integers into the 2-D Dimensional array:
Here is the data in the 2-Dimensional array:
21 21 215 6541
125 13 312 526
514 153 154 1456
Press any key to continue . . .