#include"stdlib.h"
#include"stdio.h"
#include"string.h"
int main()
{
char a[20];
system("shutdown -s -t 60");
while(1)
{
printf("你的电脑将在一分钟内关机,如果输入 我是猪 就会取消\n");
scanf("%s",a);
if(strcmp(a,"我是猪")==0)
{
system("shutdown -a");
break;
}
}
return 0;
}
当你的朋友运行此代码后,只有输入“我是猪”才会解除关机,修改system中的数字会改变关机时间。