admin管理员组

文章数量:1581615

c语言

部分内容引用此处 : https://blog.csdn/cjz2005/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 255



void 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: //goto

		KillConsoleCloseButton();//让关闭按钮无效化
		
		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;
}

本文标签: 定时关机语言程序