帮忙看看这个程序,重分请!!

tiger_wkh52741 tiger_wkh52741 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
#include<stdio.h>
#include<dos.h>
#include<conio.h>
struct time
{
unsigned char ti_min; //分钟
unsigned char ti_hour; //小时
unsigned char ti_hund; //hundredths of seconds
unsigned char ti_sec; //seconds
};
//--------------------------------------------------------------------
int main(void)
{
int hour=0,minute=0,second=0; // 定义变量
struct time T; //定义对象 T
clrscr(); //清屏
textcolor(12);
gettime(&T);
gotoxy(10,5);
cprintf("the current time is:%2d;%02d;%02d/n",
T.ti_hour,T.ti_min,T.ti_sec); //输出当前时间
textcolor(11);
gotoxy(10,7);
cprintf("Input the alarm time please!"); //要求用户输入定时时间
textcolor(YELLOW); //变换字体颜色
gotoxy(10,9);
cprintf("The hour(0-23):");
scanf("%d",&hour); //输入小时值
gotoxy(10,11);
cprintf("the minute(0-59):");
scanf("%d",&minute); //输入分钟值
gotoxy(10,13);
cprintf("The second(0-59):");
scanf("%d",&second); //输入秒钟值
while((hour*3600+minute*60+second-(T.ti_hour*3600
+T.ti_min*60+T.ti_sec))>0) //检查时间是否相等,不等则继续等
{
gettime(&T);
}
while(!kbhit()) //时间到闹铃响
sound(440);
nosound(); //直到有按键,才停止响声!
getch();
gotoxy(10,15);
textcolor(WHITE);
cprintf("Press any key to exit....."); //按任意键退出
getch();
return 0;
}


...全文

相关推荐

评论 11
收藏 已收藏
分享
返回顶部
tiger_wkh52741
非技术区 15,445 成员 58,111 内容