闹钟程序--爱护眼睛

主程序


#include "stdio.h"
#include "time.h"
#include "dos.h"
main()
{
int a;
while(1)
   {
printf("1.dingshi;\n");
printf("2.shizhong.\n");
printf("please choice:");
scanf("%d",&a);
switch(a)
      {
case 1:clrscr();dingshi();break;
case 2:clrscr();shizhong();break;
default:printf("please enter right number!!!\n"); getch();   break;
      }
clrscr();
   }
}
dingshi()
{
int a, timer;
printf("please enter time:(by minute,the big number is 546)");
scanf("%d",&a);
timer=a*60;
printf("It will work in %d seconds later",timer);
sleep(timer);
system("11.exe");
}

shizhong()
{
int h,m,s,A,B,timer=60;
time_t t;
struct tm *b;
 printf("please enter hour:");
scanf("%d",&A);
 printf("\nplease enter minute:");
scanf("%d",&B);
 printf("\nthe program will work in %d:%d",A,B);
while(1)
    {
time(&t);
b=localtime(&t);
h=b->tm_hour;
m=b->tm_min;
s=b->tm_sec;
if(h==A&&m==B)
system("11.exe");
sleep(timer);
    }
}

分支程序


#include "conio.h"
#include "dos.h"
main()
{
int c;
textbackground(GREEN);
textcolor(RED);
gotoxy(12,12);
cprintf("It is the time to rest!!!    Leave the computer now !!!\r\n");
while(1)
{
for(c=10000;c>0;c--)
{sound(c);
 delay(1111);
}
nosound();
}
}
  • 这是2010年时发布的代码
  • 最早学会的语言就是C语言
  • 还曾拿过学院竞赛第一
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值