Monday 21 August 2017

Manual Clock Project

#include<graphics.h>
#include<stdio.h>
void clock(void);
void clock1(void);
void main()
{
int a,x,y,d,m;
d=DETECT;
initgraph(&d,&m,"C:\\TC\\BGI");
cleardevice();
setcolor(4);
outtextxy(100,100,"Press Any Key Repeatedly and See the Trick");
clock();
for(x=303,y=150;x<=353;x=x+5)
    {
    setcolor(4);
    line(303,210,x,y+5);
    getch();
    cleardevice();
    clock();
    }
for(x=353,y=155;x<=403,y<=180;x+=5,y+=3)
    {
    setcolor(4);
    line(303,210,x,y);
    getch();
    cleardevice();
    clock();
    }
for(x=403,y=180;y<=250;y=y+5)
    {
    setcolor(4);
    line(303,210,x,y);
    getch();
    cleardevice();
    clock();
    }
for(x=403,y=250;x>=350,y<=270;x-=5,y+=2)
    {
    setcolor(4);
    line(303,210,x,y);
    getch();
    cleardevice();
    clock();
    }
for(x=350,y=270;x>=250;x-=5)
    {
    setcolor(4);
    line(303,210,x,y);
    getch();
    cleardevice();
    clock();
    }
for(x=250,y=270;x>=200,y>=250;x-=4,y-=2)
    {
    setcolor(4);
    line(303,210,x,y);
    getch();
    cleardevice();
    clock();
    }
for(x=200,y=250;y>=170;y-=4)
    {
    setcolor(4);
    line(303,210,x,y);
    getch();
    cleardevice();
    clock();
    }
for(x=200,y=170;x<=250,y>=150;x+=5,y-=1)
    {
    setcolor(4);
    line(303,210,x,y);
    getch();
    cleardevice();
    clock();
    }
cleardevice();
clock1();
getch();
closegraph();
}

void clock(void)
{
setbkcolor(14);
setcolor(2);
outtextxy(350,150,"1");
outtextxy(250,150,"11");
outtextxy(300,150,"12");

outtextxy(400,170,"2");
outtextxy(400,210,"3");
outtextxy(400,250,"4");

outtextxy(350,270,"5");
outtextxy(300,270,"6");
outtextxy(250,270,"7");

outtextxy(200,250,"8");
outtextxy(200,210,"9");
outtextxy(200,170,"10");

setcolor(1);
line(180,130,420,130);
line(180,290,420,290);
line(180,130,180,290);
line(420,130,420,290);
circle(303,210,7);
setcolor(6);
setlinestyle(0,0,3);
line(303,210,303,250);
setcolor(11);
setlinestyle(0,5,2);
line(303,210,303,155);
}


void clock1(void)
{
setbkcolor(14);
setcolor(2);
outtextxy(350,150,"1");
outtextxy(250,150,"11");
outtextxy(300,150,"12");

outtextxy(400,170,"2");
outtextxy(400,210,"3");
outtextxy(400,250,"4");

outtextxy(350,270,"5");
outtextxy(300,270,"6");
outtextxy(250,270,"7");

outtextxy(200,250,"8");
outtextxy(200,210,"9");
outtextxy(200,170,"10");

setcolor(1);
line(180,130,420,130);
line(180,290,420,290);
line(180,130,180,290);
line(420,130,420,290);
circle(303,210,7);
setcolor(6);
setlinestyle(0,0,3);
line(303,210,303,250);
setcolor(11);
setlinestyle(0,5,2);
line(303,210,313,155);
setcolor(4);
line(303,210,303,155);
getch();
}

0 comments: