How to print matrix ?

I wants to print matrix such that

Consider that original matrix look like following

1 2 3
4 5 6
7 8 9

Now I want to print like following

7 8 9
4 5 6
1 2 3

we can use only two for loops.
Assuming that you input the matrix in the console, the shortest way would be to take every line as a string into a vector, then put in a reverse iterator loop while couting it.

But if it's hardcoded into a plain array and if you must use 2 for loops, you would nest the loops as if you are printing it, but for the y loop, make y = height, and while y>0, do --y.
Topic archived. No new replies allowed.