//----------------------------------------------- // Lab03.cpp // // Draw a regular Polygon // // D. Searls // REPLACE THIS LINE WITH YOUR NAME // Asbury University //----------------------------------------------- #include #include #include using namespace std; const double PI = 3.14159265358979; //---------------------------------------------- // drawPolygon // // This function draws a regular n-sided polygon // using the specified color. It will have the // specified (circumscribed) radius and be // centered on the specified point. // // In parameters: color, centerX, centerY, // radius, n //---------------------------------------------- void drawPolygon(int color, int centerX, int centerY, int radius, int n) { // Implement this function } int main() { int grErrCode; int x, y; int sides; int radius; // Initialize a 201 by 201 graphics window here. srand(time(NULL)); do { cout << "\nEnter number of sides: (2 or less to terminate): "; cin >> sides; if (sides >= 3) { cout << "Enter x-coordinate of center point: "; cin >> x; cout << "Enter y-coordinate of center point: "; cin >> y; cout << "Enter radius: "; cin >> radius; drawPolygon(rand()%15+1, x, y, radius, sides); } } while (sides >= 3); closegraph(); return 0; }