Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Draw polygons using giving coordinates. TA comment: Try using GetLine() to get p

ID: 662826 • Letter: D

Question

Draw polygons using giving coordinates.

TA comment: Try using GetLine() to get polygon.dat from the user. You should also look into stdio.h file related functions, including fopen and fclose.

Using the graphics library form Chapter 7, write a program that displays polygons o the screen. The coordinates form the vertices of a polygon are stored in a data file, one coordinate pair per line. Each coordinate consists of two floating-point numbers enclosed in parentheses and separated by a comma. The input file may contain vertex coordinates for several different polygons; each polygon is separated from the preceding one by a blank line in the file. For example, the file polygon.dat contains the coordinates for a square and a triangle, as follows: (0.5, 0.5) (2.0, 0.5) (3.0, 0.5) Your program should read the input file and draw the polygons on the screen. Given the input file polygon.dat, the display should look like this:

Explanation / Answer

figure.h

graphics.h

matrix.h

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote