0

Spiral array in C++

How to print a spiral array in C++ Something like this: 1 16 15 14 13 2 17 24 23 12 3 18 25 22 11 4 19 20 2110 5 6 7 8 9

29th Jan 2018, 12:15 PM
Winter Soldier
Winter Soldier - avatar
3 Antworten
+ 14
First thing which came to mind would be code written by fellow SoloLearner John Wells, proper comments included for other users like you. https://code.sololearn.com/c8CxJboIHmAQ/?ref=app Look up Code Playground for more examples.
29th Jan 2018, 12:18 PM
Hatsy Rei
Hatsy Rei - avatar
+ 6
if you visualize an array as... -->rows | columns v it becomes pretty simple.
29th Jan 2018, 1:10 PM
D_Stark
D_Stark - avatar
21st Mar 2018, 3:26 PM
Abhimanyu Gupta
Abhimanyu Gupta - avatar