Giriş ya da Kayıt Ücretsiz!
Icon Anasayfa > Kod Bankası > C - Örnek
C - Örnek
Tarih 22/07/2008 16:45 Yazar Coder Hitler 638
Print Pdf RSS

/* Display a software timer. */
#include <stdio.h>
#define DELAY 128000
  struct my_time {
  int hours;
  int minutes;
  int seconds;
  } ;
void display(struct my_time *t);
  void update(struct my_time *t);
  void delay(void);
int main(void)
  {
  struct my_time systime;
systime.hours = 0;
  systime.minutes = 0;
  systime.seconds = 0;
for(;;) {
  update(&systime);
  display(&systime);
  }
return 0;
  }
void update(struct my_time *t)
  {
  t->seconds++;
  if(t->seconds==60) {
  t->seconds = 0;
  t->minutes++;
  }
if(t->minutes==60) {
  t->minutes = 0;
  t->hours++;
  }
if(t->hours==24) t->hours = 0;
  delay();
  }
void display(struct my_time *t)
  {
  printf("%02d:", t->hours);
  printf("%02d:", t->minutes);
  printf("%02d\n", t->seconds);
  }
void delay(void)
  {
  long int t;
/* change this as needed */
  for(t=1; t<DELAY; ++t) ;
  }



Kaynak: SELAM.tk
Tags - Del Tec Bli Spu Dig
Yorum Yok.
Icon Üye Menüsü
Merhaba Ziyaretçi
IP: 38.107.179.242

Kullanıcı Adı
Şifre
Icon Kur'an-ı Kerim
Icon Boykot Ediyoruz !
Icon Kimler Var?
US 38.107.x.x
US 38.107.x.x
Unknown 178.154.x.x
US 38.107.x.x
US 38.107.x.x
US 38.107.x.x
Unknown 157.55.x.x
Unknown 157.55.x.x
Unknown 180.76.x.x
US Google spider
US Google spider
US Google spider
US Google spider
US Google spider
US MSN spider
US Google spider
US Google spider
US Google spider
US Google spider
US MSN spider
US Google spider
US Google spider
US Google spider
US Google spider
Unknown MSN spider
Unknown MSN spider
US Google spider
Unknown MSN spider
Bu Alana Reklam Vermek İster misiniz? - reklam@resetat.com