1.程序代码
#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <Windows.h>
int main()
{
char input[10] = { 0 };//定义参数 存放输入的字符
system("shutdown -s -t 60");//调用系统函数 自动关机在60s后
again://goto语句将要跳到的地方
printf("请输入'我是猪',否则电脑将在1分钟后关机!\n请输入:");
scanf("%s", &input);
if (0 == strcmp(input, "我是猪"))//strcmp是字符判断函数
{
system("shutdown -a");
}
else
{
goto again;//跳到again
}
system("pause");
return 0;
}