Reverse a output | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Reverse a output

hello, on line 173 starts the print function , this function prints out the maze: for(int i = 0; i < grid.size(); i++){ for(int j = 0; j < grid[i].size(); j++){ cout << grid[i][j] << " "; } } how do i reverse this output i want the x axis reversed and the y axis reversed thx in advance if you want to know why i want this reversed try solving it like normal and then start from the end, when you start from the end the maze becomes much harder that how the algorithm works https://code.sololearn.com/cqbnQ9W1kXlq/?ref=app

31st Aug 2019, 9:53 AM
Cat Sauce
Cat Sauce - avatar
2 Answers
+ 2
you can go throw the array in reverse like this: for(int i=grid.size()-1;i>=0;i--){
31st Aug 2019, 10:06 AM
Anton Böhler
Anton Böhler - avatar
+ 1
Anton Böhler wow, thank you :)
31st Aug 2019, 10:36 AM
Cat Sauce
Cat Sauce - avatar