Kod: Kodu kopyalamak için üzerine çift tıklayın!
#include <stdio.h>
#include <windows.h>
#include <conio.h>
#include <time.h>
void saat_ciz(int,int);
void rakam_ciz(int,int,int);
void git(int,int);
void tarih_yaz(void);
main()
{
system("color F0");
int x=25,y=5,sayac;
for(sayac=0;;sayac++)//sonsuz döngüde
{
Sleep(200);//uykuya geçiyor.
system("cls");
x=x+3;
if(x>54)//genişlik
{
x=0;
y=y+3;
if(y>14)//yükseklik
y=0;
}
saat_ciz(x,y);//tekrar saati yazdırıyot
}
getch();
}
void git(int x,int y)//Bu fonksiyon imleci verilen koordinatlara götürür
{
COORD koord;
koord.X = x;
koord.Y = y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), koord);
}
void rakam_ciz(int rakam,int x,int y)
{
if(rakam==0)//0
{
git(x,y);printf("%c%c%c%c",219,219,219,219);
git(x,y+1);printf("%c %c",219,219);
git(x,y+2);printf("%c %c",219,219);
git(x,y+3);printf("%c %c",219,219);
git(x,y+4); printf("%c %c",219,219);
git(x,y+5);printf("%c %c",219,219);
git(x,y+6);printf("%c %c",219,219);
git(x,y+7);printf("%c %c",219,219);
git(x,y+8);printf("%c%c%c%c",219,219,219,219);
}
else if(rakam==1)//1
{
git(x,y);printf("%4c",219);
git(x,y+1);printf("%4c",219);
git(x,y+2);printf("%4c",219);
git(x,y+3);printf("%4c",219);
git(x,y+4);printf("%4c",219);
git(x,y+5);printf("%4c",219);
git(x,y+6);printf("%4c",219);
git(x,y+7);printf("%4c",219);
git(x,y+8);printf("%4c",219);
}
else if(rakam==2)//2
{
git(x,y);printf("%c%c%c%c",219,219,219,219);
git(x,y+1);printf("%4c",219);
git(x,y+2);printf("%4c",219);
git(x,y+3);printf("%4c",219);
git(x,y+4);printf("%c%c%c%c",219,219,219,219);
git(x,y+5);printf("%c ",219);
git(x,y+6);printf("%c ",219);
git(x,y+7);printf("%c ",219);
git(x,y+8);printf("%c%c%c%c",219,219,219,219);
}
else if(rakam==3)//3
{
git(x,y);printf("%c%c%c%c",219,219,219,219);
git(x,y+1);printf("%4c",219);
git(x,y+2);printf("%4c",219);
git(x,y+3);printf("%4c",219);
git(x,y+4);printf("%c%c%c%c",219,219,219,219);
git(x,y+5);printf("%4c",219);
git(x,y+6);printf("%4c",219);
git(x,y+7);printf("%4c",219);
git(x,y+8);printf("%c%c%c%c",219,219,219,219);
}
else if(rakam==4)//4
{
git(x,y);printf("%c %c",219,219,219,219);
git(x,y+1);printf("%c %c",219,219,219,219);
git(x,y+2);printf("%c %c",219,219,219,219);
git(x,y+3);printf("%c %c",219,219,219,219);
git(x,y+4);printf("%c%c%c%c",219,219,219,219);
git(x,y+5);printf("%4c",219,219,219,219);
git(x,y+6);printf("%4c",219);
git(x,y+7);printf("%4c",219);
git(x,y+8);printf("%4c",219);
}
else if(rakam==5)//5
{
git(x,y);printf("%c%c%c%c",219,219,219,219);
git(x,y+1);printf("%c ",219,219,219,219);
git(x,y+2);printf("%c ",219,219,219,219);
git(x,y+3);printf("%c ",219,219,219,219);
git(x,y+4);printf("%c%c%c%c",219,219,219,219);
git(x,y+5);printf("%4c",219,219,219,219);
git(x,y+6);printf("%4c",219,219,219,219);
git(x,y+7);printf("%4c",219,219,219,219);
git(x,y+8);printf("%c%c%c%c",219,219,219,219);
}
else if(rakam==6)//6
{
git(x,y);printf("%c%c%c%c",219,219,219,219);
git(x,y+1);printf("%c",219,219,219,219);
git(x,y+2);printf("%c",219,219,219,219);
git(x,y+3);printf("%c",219,219,219,219);
git(x,y+4);printf("%c%c%c%c",219,219,219,219);
git(x,y+5);printf("%c %c",219,219,219,219);
git(x,y+6);printf("%c %c",219,219,219,219);
git(x,y+7);printf("%c %c",219,219,219,219);
git(x,y+8);printf("%c%c%c%c",219,219,219,219);
}
else if(rakam==7)//7
{
git(x,y);printf("%c%c%c%c",219,219,219,219);
git(x,y+1);printf("%4c",219);
git(x,y+2);printf("%4c",219);
git(x,y+3);printf("%4c",219);
git(x,y+4);printf("%4c",219);
git(x,y+5);printf("%4c",219);
git(x,y+6);printf("%4c",219);
git(x,y+7);printf("%4c",219);
git(x,y+8);printf("%4c",219);
}
else if(rakam==8)
{
git(x,y);printf("%c%c%c%c",219,219,219,219);
git(x,y+1);printf("%c %c",219,219);
git(x,y+2);printf("%c %c",219,219);
git(x,y+3);printf("%c %c",219,219);
git(x,y+4);printf("%c%c%c%c",219,219,219,219);
git(x,y+5);printf("%c %c",219,219);
git(x,y+6);printf("%c %c",219,219);
git(x,y+7);printf("%c %c",219,219);
git(x,y+8);printf("%c%c%c%c",219,219,219,219);
}
else if(rakam==9)
{
git(x,y);printf("%c%c%c%c",219,219,219,219);
git(x,y+1);printf("%c %c",219,219);
git(x,y+2);printf("%c %c",219,219);
git(x,y+3);printf("%c %c",219,219);
git(x,y+4);printf("%c%c%c%c",219,219,219,219);
git(x,y+5);printf("%4c",219);
git(x,y+6);printf("%4c",219);
git(x,y+7);printf("%4c",219);
git(x,y+8);printf("%c%c%c%c",219,219,219,219);
}
else if(rakam==10)
{
git(x,y+1);printf(" %c%c",219,219);
git(x,y+2);printf(" %c%c",219,219);
git(x,y+4);printf(" %c%c",219,219);
git(x,y+5);printf(" %c%c",219,219);
}
}
void tarih_yaz(void)
{
time_t zaman;
struct tm * zaman_bilgisi;
char kelime [80];
time ( &zaman );
zaman_bilgisi = localtime ( &zaman );
strftime (kelime,80,"%d.%m.%Y",zaman_bilgisi);
printf("%s", kelime);
}
void saat_ciz(int x,int y)
{
int saat_onlar,saat_birler,dakika_onlar,dakika_birler;
time_t zaman;
tm * zaman_ptr;
time ( &zaman );
zaman_ptr = localtime ( &zaman );
saat_onlar=((zaman_ptr->tm_hour)%24)/10;
saat_birler=((zaman_ptr->tm_hour)%24)%10;
dakika_onlar=(zaman_ptr->tm_min)/10;
dakika_birler=(zaman_ptr->tm_min)%10;
rakam_ciz(saat_onlar,x,y);
rakam_ciz(saat_birler,x+6,y);
rakam_ciz(10,x+10,y+1);//iki nokta için
rakam_ciz(dakika_onlar,x+16,y);
rakam_ciz(dakika_birler,x+22,y);
git(x+9,y+10); tarih_yaz();
}