當前位置:編程學習大全網 - 編程軟體 - 高分求用C語言編的鬧鐘程序或者定時提醒程序300-400行之間

高分求用C語言編的鬧鐘程序或者定時提醒程序300-400行之間

給,已經編譯運行確認了:

#include<conio.h>

#include <stdio.h>

#include<stdlib.h>

#include<time.h>

#include<string.h>

int GetHour(char *s)

{

char *p, *q;

p = (char *)malloc(10);

strcpy(p, s);

q = p;

while(*q != ':')

{

q++;

}

*q = '\0';

return atoi(p);

}

int GetMinute(char *s)

{

char *p;

p = (char *)malloc(10);

strcpy(p, s);

while(*p != ':')

{

p++;

}

p++;

return atoi(p);

}

main()

{

char s[10];

int hour,minute;

time_t t;

struct tm *timeinfo;

printf("please input the time like [18:30]:\n");

gets(s);

hour = GetHour(s);

minute = GetMinute(s);

while(1)

{

time(&t);

timeinfo = localtime(&t);

if(timeinfo->tm_hour < hour)continue;

else if(timeinfo->tm_min < minute)continue;

else

{

printf("Time is up!Wake up!\n\007");

printf("\a\a\a\a");

exit(0);

}

}

}

  • 上一篇:c語言編程,請編寫程序實現:max()函數功能是求任意3個數中最大值,min()
  • 下一篇:跪求高清 數據庫技術及安全教程,求教材百度網盤啊!急急急!
  • copyright 2024編程學習大全網