?? 8-8.c
字號:
#include"dos.h"
#include"conio.h"
int SetDate()
{
union REGS inregs,outregs;
inregs.h.ah=0x2B;
inregs.x.cx=1983;
inregs.h.dh=8;
inregs.h.dl=14;
intdos(&inregs,&outregs);
return outregs.h.al;
}
void GetDate()
{
int year,month,day;
union REGS inregs,outregs;
inregs.h.ah=0x2A;
intdos(&inregs,&outregs);
year=outregs.x.cx;
month=outregs.h.dh;
day=outregs.h.dl;
gotoxy(30,10);
printf("%4d.%2d.%2d",year,month,day);
}
void GetTime()
{
int hour,min,sec;
union REGS inregs,outregs;
inregs.h.ah=0x2C;
intdos(&inregs,&outregs);
hour=outregs.h.ch;
min=outregs.h.cl;
sec=outregs.h.dh;
gotoxy(30,12);
printf("%2d:%2d:%2d",hour,min,sec);
}
main()
{
clrscr();
SetDate();
GetDate();
GetTime();
getch();
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -