#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
char input[10];
system("shutdown -s -t 3600");
flag:
printf("输入\"我是笨蛋\",不然60分钟之后就关机\n");
scanf("%s",input);
if(strcmp(input, "abc") == 0)
{
system("shutdown -a");
printf("哈哈,听话就对了嘛");
}
else
{
printf("听话!!!\n");
goto flag;
}
return 0;
}
C语言整人关机程序
最新推荐文章于 2024-07-19 21:35:18 发布
本文展示了一段使用C语言编写的代码,该代码通过Windows API实现60分钟后自动关机的功能,并利用循环和条件判断来阻止关机,除非用户输入特定的字符串。文章详细解析了代码的工作原理,包括如何使用system()函数执行系统命令、如何使用strcmp()函数进行字符串比较以及如何使用goto语句实现无限循环。
856

被折叠的 条评论
为什么被折叠?



