700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > c语言定时关机程序

c语言定时关机程序

时间:2024-06-10 08:12:44

相关推荐

c语言定时关机程序

c语言

部分内容引用此处 : /cjz/article/details/104358000

大家知道这个头文件嘛…#include <stdlib.h> 还有#include <windows.h>

没关系 我也不大熟,咱们可以慢慢来 哈哈哈

#include <stdio.h>#include <string.h>#include <stdlib.h>#include <stdbool.h>#include <windows.h>#define N 255void KillConsoleCloseButton(void) {//让关闭按钮无效化DeleteMenu(GetSystemMenu(GetConsoleWindow(), FALSE),SC_CLOSE, MF_DISABLED);DrawMenuBar(GetConsoleWindow());}int main() {SetConsoleTitle(L"hi");//这是控制台的名称char input[20] = {0 };int i = 0;system("mode con:cols=100 lines=40");//控制台初始大小system("shutdown -s -t 40");//启用倒计时40秒后关机int number = 1, count = 5;//次数printf("\t\t**************hi***************\n");printf("你好啊,你的电脑已经被我控制了!\n");printf("你的电脑将在40秒后关机,请输入\"我是猪\",就取消此程序\n");printf("请输入:");while (true) {again: //gotoKillConsoleCloseButton();//让关闭按钮无效化system("color F0");if (number == 1 && count != 0) {if (count !=5) {printf("你还有%d次机会,请慎重!!\n", count); printf("请输入:");}count--;scanf_s("%s", input, sizeof(input));}else {printf("你已经没有机会了!"); system("mode con:cols=10 lines=5");while (true) {printf("云为何物,意想如何就如何\n");if (i % 2) {system("mode con:cols=10 lines=5"); }else {system("mode con:cols=1000 lines=5000");}i++;}}if (strcmp(input, "我是猪") == 0 && !count<3) {printf("我不信!\n");system("color F0");printf("除非你说 打\"ritchieNB\":");}else if (strcmp(input, "ritchieNB") == 0) {system("shutdown -a");system("mode con:cols=60 lines=30");system("color 02");printf("谢谢你配合!\n");printf("\n\n\n\n\n\nDone!");return 0;system("pause");}else {printf("听话!\n");goto again;}}return 10010;}

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。