Printing Current Date on Screen
CODE
#include<conio.h>
#include<iostream.h>
#include<dos.h>
void main()
{
clrscr();
struct date d;
getdate(&d);
int d=d.da_day;
int m=d.da_mon;
int y=d.da_year;
cout<<d<<"/"<<m<<"/"<<y;
getch();
}
#include<iostream.h>
#include<dos.h>
void main()
{
clrscr();
struct date d;
getdate(&d);
int d=d.da_day;
int m=d.da_mon;
int y=d.da_year;
cout<<d<<"/"<<m<<"/"<<y;
getch();
}
Printing Current Time on Screen
CODE
#include<conio.h>
#include<iostream.h>
#include<dos.h>
void main()
{
clrscr();
struct dostime_t t;
_dos_gettime(&t);
int h=t.hour;
int min=t.minute;
int s=t.second;
cout<<h<<":"<<min<<":"<<s;
getch();
}
#include<iostream.h>
#include<dos.h>
void main()
{
clrscr();
struct dostime_t t;
_dos_gettime(&t);
int h=t.hour;
int min=t.minute;
int s=t.second;
cout<<h<<":"<<min<<":"<<s;
getch();
}
I hope now you will be able to print current date and time on screen. But can you make the date and time continuously updating itself in the same program? If yes, then tell me because I don't know how to do it.

