📄 code.c
字号:
#include <stdio.h>
#include <conio.h>
#include <dos.h>
void main(void)
{
struct date today;
struct time now;
getdate(&today); /*把系统当前日期存入today所指向的date结构中*/
gettime(&now); /*把系统当前时间存入now所指向的time结构中*/
/*设定字符颜色和背景色*/
textcolor(LIGHTGREEN);
textbackground(BLUE);
/*当输入口令不对时,反复进行以下循环*/
do{
clrscr(); /*调用清屏函数*/
gotoxy(25,10);
printf("Today's date is %d-%d-%d\n",today.da_year,today.da_mon,today.da_day);
gotoxy(28,12);
printf("the time is %02d:%02d:%02d\n",now.ti_hour,now.ti_min,now.ti_sec);
gotoxy(1,1);
printf("Please Input Password:");
}
while (atoi((char *) getpass("password:")) != today.da_mon+now.ti_hour);
/*如果输入正确,则显示正确信息并退出*/
textcolor(WHITE);
textbackground(BLACK);
clrscr();
gotoxy(1,1);
printf("PASSWORD CORRECT!!\n");
printf("PRESS ANY KEY TO QUIT.\n");
getchar();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -