/***************************************************************************

 

copyright (c) Manish V. Panchmatia 2001

 

I wish to promote dissemination of this code through as many channels as

possible.

However I do wish to retain copyright on the source code, and would like to

be notified of any plans to redistribute this code.

 

I put great effort into writing this source code as accurately I could,

but you use this code at your at your own risk.

In no event I be liable for any damages resulting from the use of this work.

 

Feedback is welcome. For any requests, suggestionss, flames, etc. feel free

to contact me, at [email protected] via email.

 

***************************************************************************/

 

 

#include<graphics.h>

#include<stdio.h>

#include<bios.h>

#include<stdlib.h>

#include<dos.h>

#include<math.h>

#include<conio.h>

#include<time.h>

 

#define S 230

#define H 120

#define M 180

#define scale 3.7

#define A 2.3

#define R 100

 

void music(int d)

{

int twinkle[] = {2,2,9,9,11,11,9,0,7,7,6,6,4,4,2,

            0,9,9,7,7,6,6,4,0,9,9,7,7,6,6,4,0,

            2,2,9,9,11,11,9,0,7,7,6,6,4,4,2};

int i;

float f;

 

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

 {f = 15.4339*pow(2,scale + twinkle[i]/12.0);

  f *= (twinkle[i]!=0);

  sound(f);

  delay(400);

  nosound();

 }

 

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

 {sound(800);

  sound(900);

  delay(250);

  nosound();

  delay(800);

  }

}

 

void orbit(int clk,int mode)

{

int GraphMode;

int GraphDriver;

int i,p,t,cl,s,m,h,r,color;

float x,y,xp,yp,zx,zy,ds,dm,dh,txm,tym,txs,tys,txh,tyh,x1,y1;

struct time timep;

 

cl = 16;

 

GraphDriver = DETECT;

initgraph(&GraphDriver,&GraphMode, "" );

zx = 319;

zy = 239;

setcolor(4);

outtextxy(0,0,"Dear Netizen,");

setcolor(15);

outtextxy(0,20,"Happy Surfing");

setcolor(2);

outtextxy(0,40,"From : [email protected]");

while(1)

{ cl--;

  for(i = 1;i<25;i++)

  {

     setcolor(12);

     arc(zx-35,zy-35,300,120,40);

     arc(zx-35,zy+33,240,60,40);

     arc(zx+13,zy+33,340,125,40);

     arc(zx+55,zy-50,160,300,30);

     circle(zx+55,zy-50,3);

     setcolor((s%15)+1);

     circle(zx,zy,100);

 

     gettime(&timep);

     s = timep.ti_sec;

     m = timep.ti_min;

     h = timep.ti_hour;

     setcolor(14*clk);

     ds = 90 - 6*s;

     dm = 90 - 6*m - 0.1*s;

     dh = 90 - 30*h - 0.5*m -s/120.0;

     txs = zx + S*cos(ds*M_PI/180.0);

     tys = zy - S*sin(ds*M_PI/180.0);

     txm = zx + M*cos(dm*M_PI/180.0);

     tym = zy - M*sin(dm*M_PI/180.0);

     txh = zx + H*cos(dh*M_PI/180.0);

     tyh = zy - H*sin(dh*M_PI/180.0);

     line(zx,zy,txs,tys);

     setcolor(15*clk);

     line(zx,zy,txm,tym);

     line(zx,zy,txh,tyh);

     if ((m==0)&&(s==0)) music(h);

     if ((m==30)&&(s==0)) { sound(800);

          sound(900);

          delay(250);

          nosound();

          delay(800);

        }

 

    for(p = 30;p<151;p+=60)

      { for (t = 0;t<360;t++)

       { if(t%24==(i-1)) { cl++;

                if (cl>15) cl = 1;

                color = cl;

                if (cl==8) color = 0;

                }

       else  if (mode) color = 8;

       for(r = -2;r<0;r++)

       {  x = (R+r)*A*cos(t*M_PI/180);

          y = (R+r)*sin(t*M_PI/180);

          x1 = x*cos(p*M_PI/180)-y*sin(p*M_PI/180)+zx;

          y1 = x*sin(p*M_PI/180)+y*cos(p*M_PI/180)+zy ;

          putpixel(x1,y1,color);

       }

     }

      }

     setcolor(0);

     line(zx,zy,txs,tys);

     line(zx,zy,txm,tym);

     line(zx,zy,txh,tyh);

     if (bioskey(1))

     { restorecrtmode();

       getch();

       return;

     }

   }

}

}

 

main()

{

 

int GraphMode;

int GraphDriver;

char c;

 

orbit(1,0);

orbit(1,1);

 

restorecrtmode();

 

}

Hosted by www.Geocities.ws

1