#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
char input[20] = { 0 };
system("shutdown -s -t 120");//system() - 库函数-执行系统命令
again:
printf("请注意,你的电脑在二分钟内关机,如果输入:我是猪,就取消关机\n");
scanf("%s", input);
//判断
if (strcmp(input, "我是猪") == 0)
{
//取消关机
system("shutdown -a");
}
else
{
goto again;
}
return 0;
}
运行如下:
只有承认“我是猪”才可解除注销电脑