#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
int main()
{
int a,b;
printf("定时关机\n-------------------------\n");
printf("请输入分");
scanf("%d",&a);
printf("请输入秒");
scanf("%d",&b);
if(b>60)
{
b=00;
a++;
}
printf("%d:%d",a,b);
while(1)
{
Sleep(10);
b--;
system("cls");
printf("%d:%d",a,b);
if(b<00)
{
b=60;
a--;
}
if(b<10)
{
system("cls");
printf("%d:0%d",a,b);
}
if(a<0)
{
system("cls");
printf("时间到!");
break;
}
}
system("shutdown -s -t 50");
system("pause");
return 0;
}
帮主可以再改改,只能帮你到这而了! |