⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 8-8.c

📁 一本经典书籍--C程序员成长攻略的原代码
💻 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 + -