Exercise: Drawing a Polygon

  1. Use LineTo() and Ellipse() to draw the following figure.
  2. Hint: You may need to include <cmath> to utilize the sin() and cos() function.
  3. Note: You should draw a polygon which is symmetric to the y-axis, so that it looks like a "standing polygon" instead of a lying-down polygon.
  4. Be advised to design your drawing function to be generic enough, because a few weeks later you will re-use this function to draw polygons with 5 vertices, 7 vertices, or 3 vertices.
  5. Compress all files under your project into a ZIP file and upload it to Moodle.
  6. Note that the upload limit of Moodle for each file is 50MB, so you may delete all .pch .ipch .obj .exe files so that your ZIP file is less than 50MB.
ex-polygon.png