Reputation:
I have been trying to figure out how can we print a array hellically but i am stuck on how to get started.Any algorithms or ideas will be very helpful.Thanks HELLICALLY means printing the array in concentric circular shape
Upvotes: 1
Views: 196
Reputation: 51039
If I'm interpreting what you're saying correctly, you want to print the contents of an array, but in a spiral.
I would start by allocating a big rectangular block of memory (a 2-D array) and initializing it to zero. This represents the screen. Then devise a function for determining the coordinates of the next point in the circle and make some coordinate variables initialized to the origin point. Fill the screen by dropping array members wherever they go.
Print out the screen-array, one row at a time, but substitute space for zero.
Screen size and next-coordinate-function are left as exercises for the reader.
Upvotes: 1