Learn to Code
John F. Dumas
contact me | resume | how it works | example programs | testimonials | main page

C++ - Spiral

► Problem Description: Author a c++ program that can draw spiral figures similar to the ones shown below. Use svg for output and parameterize your code so that you can easily change the number of sides, the depth, the position where each line intersects the next and whether or not the spiral is reversed.

► Inputs And Outputs:

Here's an example that has six sides, a depth of 20, connections at 15% of the next side length and is drawn reversed.

Here is a spiral drawn with eight sides, a depth of 15, connections at 20% and not reversed.

Source code

All source files (zip file)

Back to Example Program Index

© John F. Dumas | johnfdumas@gmail.com | main page | top of page