1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
|
#include<iostream.h>
#include<iomanip.h>
#include<math.h>
#include<conio.h>
#include<graphics.h>
#include<time.h>
#include<iostream.h>
#include<conio.h>
#include<dos.h>
#include<string.h>
void main()
{
clrscr();
time_t t;
int y,m,d,h,mi,s,da,vh1,h1;
float vs=0,vh,vm;
char day[9];
int a=DETECT,b;
initgraph(&a,&b,"C:\\turboc3\\bgi");
while(1)
{
sound(1000);
setfillstyle(1,1);
setcolor(2);
clrscr();
cleardevice();
setbkcolor(4);
t=time(0);
struct tm *now=localtime(&t);
y=now->tm_year+1900;
m=now->tm_mon+1;
d=now->tm_mday;
h=h1=now->tm_hour;
mi=now->tm_min;
s=now->tm_sec;
da=now->tm_wday;
switch(da)
{
case 0:
strcpy(day,"SUNDAY");
break;
case 1:
strcpy(day,"MONDAY");
break;
case 2:
strcpy(day,"TUESDAY");
break;
case 3:
strcpy(day,"WEDNESDAY");
break;
case 4:
strcpy(day,"THURSDAY");
break;
case 5:
strcpy(day,"FRIDAY");
break;
case 6:
strcpy(day,"SATURDAY");
break;
}
if(h>=12)
h-=12;
vh1=h*60+mi;
vs=3.14159*s/30;
vh=3.14159*vh1/360;
vm=3.14159*mi/30;
settextstyle(5,0,5);
outtextxy(160,0,"PRATTY CLOCK"); //SHOWS MY NICKNAME
line(0,70,639,70);
line(0,69,639,69);
fillellipse(320,240,100,100);
settextstyle(2,0,5);
outtextxy(316,121,"12");
outtextxy(375,135,"1");
outtextxy(410,177,"2");
outtextxy(410,287,"4");
outtextxy(373,329,"5");
outtextxy(259,329,"7");
outtextxy(222,285,"8");
outtextxy(219,178,"10");
outtextxy(259,135,"11");
outtextxy(317,341,"6");
outtextxy(425,232,"3");
outtextxy(208,232,"9");
line(320,240,320+90*sin(vs),240-90*cos(vs));
line(320,240,320+70*sin(vh),240-70*cos(vh));
line(320,240,320+88*sin(vm),240-88*cos(vm));
cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n "<<day<<" "<<d<<'.'<<m<<'.'<<y;
cout<<"\n\n "<<setw(2)<<h<<':'<<setw(2)<<mi<<':'<<setw(2)<<s<<" ";
if(h1>12)
cout<<"PM";
else
cout<<"AM";
nosound();
delay(1000);
}
}
|