#include <stdio.h>
#include <limits.h>
#include <stdlib.h> //system
#include <string.h> //strcmp
int main()
{
char input[20]={ 0 };//存储数据
system(“shutdown -s -t 60”);//system()专门用来执行系统命令的
again:
printf(“请注意,你的电脑在一分钟内关机,如果输入:我是猪,就取消关机\n”);
scanf("%s",input);//%s- 字符串
if(strcmp(input,“我是猪”) == 0)
{
system(“shutdown -a”);
}
else
{
goto again;
}
return 0;
}
分享一个C语言编写的关机程序
最新推荐文章于 2024-03-06 14:06:10 发布