#include <stdio.h>
#include <stdlib.h>
#include <string.h>
//关机程序
//只要运行起来,电脑就会在2分钟内关机,如果输入:我是猪,就取消关机!
//shutdown -s -t 120——两分钟内关机
//shutdown -a——取消关机命令
int main()
{
//关机
//C语言提供了一个函数:system()——执行系统命令的
char input[] = { 0 };//存放输入信息
system("shutdown -s -t 120");
again:
printf("请注意,你的电脑将在两分钟内关机,如果输入:我是猪,就取消关机!\n");
scanf("%s", input);//数组名就是地址
if (strcmp(input, "我是猪") == 0)//两个字符串比较用——strcmp()
{
system("shutdown -a");
}
else
{
goto again;
}
return 0;
}
关机_程序
最新推荐文章于 2025-04-15 17:00:39 发布