电脑在1分钟后开始关机。若输入“Cherry is the most beautiful”,则取消关机。
#include<stdio.h>
int main()
{
char input[50] = {0};
system("shutdown -s -t 60");
while(1)
{
printf("The computer will shut down in a minute!\nIf you type'Cherry is the most beautiful',cancel the shutdown\n");
scanf("%s", input);
if(0 == strcmp(input, "Cherry is the most beautiful"))
{
system("shutdown -a");
break;
}
}
return 0;
}