#include #include #include #include "polygon.h" void setgraph(); void main() { char dummy; int MAX_X, MAX_Y; int hour, minute; Polygon big("arrow.dat"); // calls constructor Polygon little=big; // calls copy constructor little.scale(1.5,0.7); cout << "Enter time (h m): "; cin >> hour >> minute; setgraph(); MAX_X = getmaxx(); MAX_Y = getmaxy(); big.scale(MAX_Y/2.0,MAX_Y/2.0); little.scale(MAX_Y/2.0,MAX_Y/2.0); big.translate(MAX_X/2.0,MAX_Y/2.0); little.translate(MAX_X/2.0,MAX_Y/2.0); big.rotate(-6*minute); little.rotate(-(30*hour+minute/2)); circle(MAX_X/2,MAX_Y/2,MAX_Y/2); big.draw(); little.draw(); cin >> dummy;; closegraph(); } void setgraph() { char dummy; int gdriver = DETECT, gmode, errorcode; initgraph(&gdriver,&gmode,"c:\\bc5\\bgi"); errorcode = graphresult(); if (errorcode != grOk) { cerr << "Error: " << grapherrormsg(errorcode); cout << "Press any key to halt: "; cin >> dummy; exit(1); } }