帮忙看看这个程序,重分请!!
#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;
}