/* POLY.C
**
** Illustrates how to draw polygons.  Note that vertices are definded 
** in an array in the form {x0, y0, x1, y1, ...}.  Thus the array must
** contain two times the number of points.  For a closed polygon, the
** last point must be the same as the first.
**
**
** Cheryl Melvin, MSU, October 7, 1993 
*/

#include <stdio.h>
#include <graphics.h>
#include <conio.h>

main()
{
	int driver, mode;
	int shape[10] = {
	10, 10,
	100, 80,
	200, 200,
	350, 90,
	10, 10
	}; /* closed polygon */

	int shape1[6] = {
	10, 10,
	80, 60,
	350, 90
	}; /* not closed */

	driver = DETECT; /* autotect */
	mode = 0;
	initgraph(&driver, &mode, "c:\\turboc");

	setcolor(RED);
	drawpoly(5, shape);  /* number of points, pointer to array */
	setcolor(GREEN);
	drawpoly(3, shape1);
	getch(); /* pause to admire */
	restorecrtmode();
	return 0;
}