#include<iostream>
#include<graphics.h>
using namespace std;
class clock
{
public:
void create()
{
rectangle(425,25,725,335);
setcolor(14);
circle(575,180,50);
setfillstyle(SOLID_FILL,14);
floodfill(575,180,14);
setcolor(10);
settextstyle(SIMPLEX_FONT,HORIZ_DIR,4);
outtextxy(650,28,"1");
outtextxy(700,98,"2");
outtextxy(700,168,"3");
outtextxy(700,238,"4");
outtextxy(648,298,"5");
outtextxy(558,298,"6");
outtextxy(468,298,"7");
outtextxy(428,238,"8");
outtextxy(428,168,"9");
outtextxy(428,98,"10");
outtextxy(460,28,"11");
outtextxy(555,28,"12");
}
void pend()
{
int a=576,b=535,r=30;
setcolor(15);
line(576,335,a,b);
circle(a,(b+r),r);
setfillstyle(SOLID_FILL,15);
floodfill(a,b+r,15);
delay(700);
setcolor(0);
line(576,335,a,b);
circle(a,(b+r),r);
setfillstyle(SOLID_FILL,0);
floodfill(a,b+r,0);
labela:
while(a!=490)
{
a=a-1;
b=b-1;
setcolor(15);
line(576,335,a,b);
circle(a,(b+r),r);
setfillstyle(SOLID_FILL,15);
floodfill(a,b+r,15);
delay(60);
setcolor(0);
line(576,335,a,b);
circle(a,(b+r),r);
setfillstyle(SOLID_FILL,0);
floodfill(a,b+r,0);
}
while(a!=575)
{
a=a+1;
b=b+1;
setcolor(15);
line(576,335,a,b);
circle(a,(b+r),r);
setfillstyle(SOLID_FILL,15);
floodfill(a,b+r,15);
delay(60);
setcolor(0);
line(576,335,a,b);
circle(a,(b+r),r);
setfillstyle(SOLID_FILL,0);
floodfill(a,b+r,0);
}
while(a!=640)
{
a=a+1;
b=b-1;
setcolor(15);
line(576,335,a,b);
circle(a,(b+r),r);
setfillstyle(SOLID_FILL,15);
floodfill(a,b+r,15);
delay(60);
setcolor(0);
line(576,335,a,b);
circle(a,(b+r),r);
setfillstyle(SOLID_FILL,0);
floodfill(a,b+r,0);
}
while(a!=575)
{
a=a-1;
b=b+1;
setcolor(15);
line(576,335,a,b);
circle(a,(b+r),r);
setfillstyle(SOLID_FILL,15);
floodfill(a,b+r,15);
delay(60);
setcolor(0);
line(576,335,a,b);
circle(a,(b+r),r);
setfillstyle(SOLID_FILL,0);
floodfill(a,b+r,0);
}
goto labela;
}
}c;
int main()
{
initwindow(1200,800,"CLOCK WITH PENDULUM");
c.create();
c.pend();
getch();
cleardevice();
closegraph();
}
No comments:
Post a Comment