.

Çavuş
31 Ekim 2012
Tarihinde Katıldı
Takip Ettikleri
0 üye
Görüntülenme (?)
10 (Bu ay: 0)
Gönderiler Hakkında
.
11 yıl
DEV C/C++ ile Analog Saat Yapımı
Analog Saat linkte ekli Dev C/C++ Görsel kütüphane eklemeyi unutmayın.
İndir

/* 
Name: Mekatronik Müh.
Copyright: Sakarya Üniversitesi
Author:
Date: 02.01.14 14:19
Description: Analog Saat
*/



#include <iostream>
#include <graphics.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;
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 ////////////////////

class LINE
{
protected:
int x, y, r;
public:
LINE():x(350),y(350),r(300){}

};

/////////////////////// HOUR LINE ////////////////////

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=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,4);
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))));
}

};

/////////////////////// MINUTE LINE ////////////////////

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)));
}

};

///////////////////// SECONDS LINE ////////////////////

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(1);
setlinestyle(SOLID_LINE, 0, 3);
line(x,y,x+(r-70)*cos(thetasec*(M_PI/180)),y-(r-70)*sin(thetasec*(M_PI/180)));
}
};

/////////////////////// CLOCK CLASS'I ////////////////////////

class CLOCK
{
Hneedle HN; // Saat
Mneedle MN; // Dakika
Sneedle SN; // Saniye

public:
void showclock(CTIME TM)
{
HN.Setangle(TM);
MN.Setangle(TM);
SN.Setangle(TM);

HN.DrawNeedle(TM);
MN.DrawNeedle();
SN.DrawNeedle();
delay(1000);
}
};

int main( )
{
FILE * pFile;
pFile = fopen ("saat.jpg","r");
if (pFile==NULL)
{
printf("\n\n Dosya eksik! \n");
int ext;
scanf("%d",&ext);
exit(0);
}
else
fclose (pFile);


CLOCK PC;
CTIME TM;

const int DELAY = 50;

initwindow( 700 , 700 , "ANALOG SAAT (Mekatronik Müh.)");

while(1)
{
TM.getctime();
readimagefile("saat.jpg", 0, 0, 700, 700);
PC.showclock(TM);
}

return( 0 );
};
.
12 yıl
Transistörlü Basit AC Yükseltec Ödev Yardım !!
Resimde görüldüğü gibi devrede direnç ve kondansatör değerleri bulunması gerekiyor. Kullanılan Transistör BC107
Kullanılan Trafo 200/15 V yani AC sinyal girişi 15 V yardımlarınız içim şimdiden teşekkürler.


Resimi nasıl küçülte bilirim ?
< Resime gitmek için tıklayın >
.
13 yıl
Elektrik Devreli Dersi Sorusu ??? Elektrik Müh. Aranıyor
Problemin Çözümünü nasıl yapabilirim ?


< Resime gitmek için tıklayın >
.
13 yıl
ACİL !! PROTEUS 8 Kullanmayı bilen varmı ?
Ares te pbc çizim oluşturmam gerekli isis e tanıtmam lazım başaramadım..
.
13 yıl
C++ Program yorumlama ACİL !!!
s
.
13 yıl
C++
silindi
.
13 yıl
Bu kod satırında nasıl işlem yapılmaktadır ? YARDIM!!
Merhaba arkadaşlar c++ yazılmış olan analog saat programındaki bu kod dizesinde nasıl işlem yapılmaktadır ? (ayrıntılı olarak)

Şimdiden Teşekkürler..




  

setcolor(0);
setlinestyle(SOLID_LINE, 0, 6);
circle(x,y,5);
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))));

.
13 yıl
C++ Program yorumlama ACİL !!!
[code]#include <iostream>
#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


.
13 yıl
silindi
silindi
.
13 yıl
DEV C/C++ ile Analog Saat Yapımı
Analog Saat linkte ekli Dev C/C++ Görsel kütüphane eklemeyi unutmayın.
İndir

/* 
Name: Mekatronik Müh.
Copyright: Sakarya Üniversitesi
Author:
Date: 02.01.14 14:19
Description: Analog Saat
*/



#include <iostream>
#include <graphics.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;
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 ////////////////////

class LINE
{
protected:
int x, y, r;
public:
LINE():x(350),y(350),r(300){}

};

/////////////////////// HOUR LINE ////////////////////

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=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,4);
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))));
}

};

/////////////////////// MINUTE LINE ////////////////////

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)));
}

};

///////////////////// SECONDS LINE ////////////////////

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(1);
setlinestyle(SOLID_LINE, 0, 3);
line(x,y,x+(r-70)*cos(thetasec*(M_PI/180)),y-(r-70)*sin(thetasec*(M_PI/180)));
}
};

/////////////////////// CLOCK CLASS'I ////////////////////////

class CLOCK
{
Hneedle HN; // Saat
Mneedle MN; // Dakika
Sneedle SN; // Saniye

public:
void showclock(CTIME TM)
{
HN.Setangle(TM);
MN.Setangle(TM);
SN.Setangle(TM);

HN.DrawNeedle(TM);
MN.DrawNeedle();
SN.DrawNeedle();
delay(1000);
}
};

int main( )
{
FILE * pFile;
pFile = fopen ("saat.jpg","r");
if (pFile==NULL)
{
printf("\n\n Dosya eksik! \n");
int ext;
scanf("%d",&ext);
exit(0);
}
else
fclose (pFile);


CLOCK PC;
CTIME TM;

const int DELAY = 50;

initwindow( 700 , 700 , "ANALOG SAAT (Mekatronik Müh.)");

while(1)
{
TM.getctime();
readimagefile("saat.jpg", 0, 0, 700, 700);
PC.showclock(TM);
}

return( 0 );
};
DH Mobil uygulaması ile devam edin. Mobil tarayıcınız ile mümkün olanların yanı sıra, birçok yeni ve faydalı özelliğe erişin. Gizle ve güncelleme çıkana kadar tekrar gösterme.