Show Mobile Navigation

Wednesday, August 29, 2012

A Simple Clock in C Graphics....

Anonymous - 00:06
#include <graphics.h>
#include <math.h>
#include <time.h>
int main()
{
   float r=0.01745,s1=0,s2=0;
   int i,j;
   int gd=DETECT, gm;
   initgraph(&gd,&gm,"c:\\turboc3\\bgi");
   setbkcolor(BLACK);

   setcolor(6);
   outtextxy(200,200,"Welcome to my clock");
   outtextxy(400,400,"Created by : ASHOK ROYAL");

   setcolor(2);
   rectangle(100,250,450,280);

for(i=0;i<348;i++)

{
setcolor(6);
rectangle(101+i,251,102+i,279);
delay(20);
}

       delay(1000);
       cleardevice();

for(i=0;i<=10;i++)
{

for(;!kbhit();)
{
setcolor(WHITE);
outtextxy(240,200,"clock");
outtextxy(245,160,"XII");
outtextxy(325,250,"III");
outtextxy(235,340,"VI");
outtextxy(165,250,"IX");
outtextxy(300,400,"Enter any key to exit");
for(j=0;j<=60;j++)
{

setcolor(BLUE);
line(250+(110*cos(s2-s1)),250+(110*sin(s2-s1)),250+(120*cos(s2-s1)),250+(120*sin(s2-s1)));
s1=s1+(6*r);

}

setcolor(RED);
circle(250,250,120);
circle(250,250,130);

setcolor(WHITE);
line(250,250,250+(100*cos(s2)),250+(100*sin(s2)));
s2=s2+(6*r);
delay(1000);
cleardevice();


}}

 getch();
 }

0 comments:

Post a Comment

Comments : Read Them Or Add One to promote us