///////////////////////////////////////////////////////////////////////////////////////// // SAAT CLASS'I /////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////// // SAAT CLASS'I /////////////////////////////////////////////////////////////////////////////////////////
#include <graphics.h>
#include <conio.h>
#include <math.h>
#include <time.h>
#include <stdlib.h>
#include <stdio.h>
struct tm *CT ;
time_t Tval ;
/////////////////////////////////////////////////////////////////////////////////////////
// CTIME CLASS'I
/////////////////////////////////////////////////////////////////////////////////////////
class CTIME
{
int hour, min, sec;
int h_24;
public:
CTIME():hour(0),min(0),sec(0),h_24(0){}
void getctime()
{
Tval = time(NULL);
CT = localtime(&Tval);
hour = CT->tm_hour;
h_24 = hour;
min = CT->tm_min;
sec = CT->tm_sec;
if(hour>12)
{hour=hour-12;}
}
int gethour() ///////////////////////
{ //
return hour; //
} ////////////////////////
int getmin() //
{ //
return min; //
} /////////////////////////
int getsec() //
{ //
return sec; //
}
};
/////////////////////////////////////////////////////////////////////////////////////////
// LINE CLASS'I (ÇİZGİ) --
/////////////////////////////////////////////////////////////////////////////////////////
class LINE
{
protected:
int x, y, r;
public:
LINE():x(350),y(350),r(300){}
};
/////////////////////////////////////////////////////////////////////////////////////////
// AKREP ÇUBUĞU
/////////////////////////////////////////////////////////////////////////////////////////
class Hneedle: public LINE
{
int hour,h,m;
public:
void Setangle(CTIME TM)
{
if(TM.gethour()>12)
hour=TM.gethour()-12;
else if(TM.gethour()<0)
hour=TM.gethour()+12;
else if(TM.gethour()==0)
hour=12;
else
hour=TM.gethour();
if(hour<4)
h=abs(TM.gethour()-3);
else
h=15-TM.gethour();
m=TM.getmin();
}
void DrawNeedle(CTIME TM)
{
setcolor(0);
setlinestyle(SOLID_LINE, 0, 6);
circle(x,y,5); // ortadaki ufak daire
line(x , y, x+(r-110)*cos(M_PI/6*h-((m/2)*(M_PI/180))), y-(r-110)*sin(M_PI/6*h-((m/2)*(M_PI/180))));
}
};
/////////////////////////////////////////////////////////////////////////////////////////
// YELKOVAN ÇUBUĞU //
/////////////////////////////////////////////////////////////////////////////////////////
class Mneedle : public LINE
{
int thetamin;
public:
void Setangle(CTIME TM)
{
if(TM.getmin()<=15)
thetamin=(15-TM.getmin())*6;
else
thetamin=450-TM.getmin()*6;
}
void DrawNeedle()
{
setlinestyle(SOLID_LINE, 0, 4);
line(x,y,x+(r-60)*cos(thetamin*(M_PI/180)),y-(r-60)*sin(thetamin*(M_PI/180)));
}
};
/////////////////////////////////////////////////////////////////////////////////////////
// SANİYE ÇUBUĞU //
/////////////////////////////////////////////////////////////////////////////////////////
class Sneedle : public LINE
{
int thetasec;
public:
void Setangle(CTIME TM)
{
if(CT->tm_sec<=15)
thetasec=(15-TM.getsec())*6;
else
thetasec=450-TM.getsec()*6;
}
void DrawNeedle()
{
setcolor(4);
setlinestyle(SOLID_LINE, 0, 3);
line(x,y,x+(r-70)*cos(thetasec*(M_PI/180)),y-(r-70)*sin(thetasec*(M_PI/180)));
}
};
/////////////////////////////////////////////////////////////////////////////////////////
// SAAT CLASS'I
/////////////////////////////////////////////////////////////////////////////////////////
class CLOCK
{
Hneedle HN;
Mneedle MN;
Sneedle SN;
public:
void showclock(CTIME TM)
{
HN.Setangle(TM);
MN.Setangle(TM);
SN.Setangle(TM);
HN.DrawNeedle(TM);
MN.Dr
DH forumlarında vakit geçirmekten keyif alıyor gibisin ancak giriş yapmadığını görüyoruz.
Üye Ol Şimdi DeğilÜye olduğunda özel mesaj gönderebilir, beğendiğin konuları favorilerine ekleyip takibe alabilir ve daha önce gezdiğin konulara hızlıca erişebilirsin.
< Bu mesaj bu kişi tarafından değiştirildi .mst -- 3 Ocak 2014; 20:16:08 >