I ran my code for this problem on my VS Code compiler and c++ shell and my code was successfully giving the expected output but it’s not working on Coding blocks compiler. Now what should I do?
Coding Blocks Compiler Error
Please send the link of your code.
Check this and tell me if you get the logic
Thank you for your help!..and also I got some logic behind it but it will be helpful for me if you can explain the whole logic!
Lines 15-24: Our i loop runs from 0 to n and it is for the columns.
j loop runs from 0 to m and it is for the rows.
When i%2==0 ie, the column number is even (0 based indexing), we have to display the elements from top to bottom. So we simply write cout<<a[j][i]<<", “;
But when the column number is odd, we have to display the elements in the reverse order. So we cout<<a[m-j-1][i]<<”, ";
Right. That is fine. But what is your question here. You just described the order of output requested in the question. Read the question once again or frame your question in another way please.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.