代码:
#include<stdio.h>
#include <stdlib.h>
#include<string.h>
///两个字符串比较的时候不能够用等于——》strcmp:要用到头文件 string.h
int main()
{
char put[20] = {0};
system("shutdown -s -t 180");
again:
printf("电脑即将在一分钟内关机想要不关机,请在一分钟内输入:“不关机”就取消关机");
scanf("%s", put);///输入的内容放在数组里
if (strcmp("不关机", put) ==0) ///判断数组里放的是不是不关机
{
system("shutdown -a");
}
else
goto again;
return 0;
}