c语言代码练习15

//使用togo跳转代码,阻止关机
#define
_CRT_SECURE_NO_WARNINGS 1 #include <stdio.h> #include <string.h> int main() { char input[20] = { 0 }; system("shutdown -s -t 60"); printf("注意!注意!,您的电脑将在1分钟后关机,请输入:我是帅哥。 才能取消关机。\n请输入:"); ayue: scanf("%s", input); if (strcmp(input, "我是帅哥") == 0) { system("shutdown -a"); printf("阻止关机成功"); } else { printf("输入错误,还有不到一分钟时间将会关机,请输入:我是帅哥 阻止关机\n请输入:"); goto ayue; } return 0; }

 

posted @ 2023-10-04 20:36  小菜阿跃  阅读(22)  评论(0)    收藏  举报