Create Calendar in Turbo C & C++ (ប្រតិទិនសុរិយគតិនៅក្នុង Turbo C & C++)

Unix Mode 

/*         CALENDAR         */

#include <stdio.h>

#include <conio.h>

#include <stdlib.h>

#include <string.h>

#include <dos.h>

 

#define  gt  gotoxy

#define  tc  textcolor

#define  tb  textbackground

 

struct dosdate_t date ;

 

/*Function shows current time*/

void cur_time()

{

      char *mer = (char *)malloc(2*sizeof(char)) ;

      while( !kbhit() ){

          struct dostime_t t ;

            _dos_gettime(&t) ;

      gt (28,21) ; tb( 0 )   ; tc(15) ;

      if (t.hour<12) mer = "AM" ;

      else strcpy (mer,"PM")    ;

      if (t.hour>12) t.hour = t.hour - 12 ;

      cprintf (" Current Time: %d:%02d:%02d  %s",t.hour,t.minute,t.second,mer) ;

      }

}

...................................................................

to be continued please download here

(Coded by: Mr. Iech Setha)

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: