Shortest Road Trip problem

For me 2nd 3rd and 4th quadrant it is giving me partial output could anyone explain.

I’d have to ask you to please elaborate your doubt.
Thank you.

There was a missing ch = cin.get() before the starting of the while loop. I have added it to line number 7; here is the modified code :

No Sagar it is giving some thing partail output see

In 2nd, 3rd and 4th quadrant the values of x or y will be negative, and since the loop you are starting from 0 and increasing it eventually it was not working. So, instead of taking the exact values of x and y you have to take the absolute value of them. I have changed a bit of your code. You can have a look at it.

Bhai vo lexographically sorted nahi dikha raha

Position your loops accordingly. Put the loops in order E>N>S>W.

I’m not getting which loop