传代码,看到划走

#include <iostream>
#include <fstream>
#include <Windows.h>
#include <conio.h>
#include <string.h>
#include <ctime>
#include <tchar.h>
#include <thread>
using namespace std;

#define n1 532
#define n2 588
#define n3 660
#define n4 698
#define n5 784
#define n6 880
#define n7 988
#define nb3 623
#define nb7 930

#define h1 1046
#define h2 1175
#define h3 1319
#define h4 1397
#define h5 1568
#define h6 1760
#define h7 1976
#define hb3 1241
#define hb7 2092

int m;
char n;
int x, y;
int a, b;
string ch_1, ch_2;
void FadeAway()
{
	Beep(n4, 150);
	Beep(n4, 150);
	Beep(h4, 300);
	Beep(hb3, 300);
	Beep(nb7, 150);
	Beep(h1, 300);
}
void f()
{
	cout << "------------------------------------------------------华丽的开始线------------------------------------------------------";
	cout << "作为一个萌新,也该坑坑人了……" << endl;
	Sleep(2000);
	cout << "好吧!system(\"start\")来一波!" << endl;
	Sleep(2000);
	cout << "似乎哪里出问题了。" << endl;
	Sleep(5000);
	//system("start")会弹出cmd窗口
	system("start");
	system("start");
	system("start");
	system("start");
	system("start");
	Sleep(1000);
	cout << "呵呵,关完没有?\n1、关完了\n2、没有" << endl;
	n = _getch();
	cout << "呵呵,管你关完没有。再见!" << endl;
	Sleep(1000);
	system("rundll32.exe user32.dll,LockWorkStation");//锁定用户
	Sleep(5000);
	cout << "呵呵,我又回来了!MEIFAXIANSHUBIAODONGBULIAOMA?" << endl;
	while (!_kbhit())//如果没有键盘按下,那么将鼠标锁定在左上角(1,1)
	{
		SetCursorPos(1, 1);
	}
	FlushConsoleInputBuffer(GetStdHandle(STD_INPUT_HANDLE));
	Sleep(2000);
	cout << "呵呵,我怎么那么喜欢说“呵呵”呢?" << endl;
	while (!_kbhit())//同上
	{
		SetCursorPos(1, 1);
	}
	cout << "呵呵,再来!" << endl;
	for (int i = 0; i < 10; i++)
	{
		system("color A0");
		Sleep(50);
		system("color B0");
		Sleep(50);
		system("color C0");
		Sleep(50);
		system("color D0");
		Sleep(50);
		system("color E0");
		Sleep(50);
		system("color F0");
		Sleep(50);
	}
	Sleep(2000);
	cout << "没把你闪瞎吧!" << endl;
	Sleep(2000);
	cout << "-------------------------------------------------------小游戏环节-------------------------------------------------------";
	srand(time(0));//产生随机种子
	for (int i = 1; i <= 3; i++)
	{
		x = rand() % 10 + 1;//产生随机数
		y = rand() % 39 + 1;//同上
		if (i == 1)
		{
			ch_1 = "汩";
			ch_2 = "汨";
		}
		if (i == 2)
		{
			ch_1 = "汆";
			ch_2 = "氽";
		}
		if (i == 3)
		{
			ch_1 = "匚";
			ch_2 = "匸";
		}
		cout << "找不同——" << i << endl;
		cout << "   1  2  3  4  5  6  7  8  9  10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 ";
		for (int j = 1; j <= 10; j++)
		{
			if (j >= 1 && j <= 9)
			{
				cout << j << "  ";
			}
			else
			{
				cout << j << " ";
			}
			for (int k = 1; k <= 39; k++)
			{
				if (j == x && k == y)
				{
					cout << ch_2 << " ";
				}
				else
				{
					cout << ch_1 << " ";
				}
			}
		}
		cout << "请依次输入行数、列数:"; cin >> a >> b;
		if (a == x && b == y)
		{
			cout << "正确!" << endl;
		}
		else
		{
			cout << "错误!" << endl;
			Sleep(2000);
			system("cls");
			i--;
		}
		if (i != 3)
		{
			cout << endl;
		}
	}
	cout << "------------------------------------------------------华丽的分割线------------------------------------------------------";
	cout << "旁白:你是一位“main”函数,代码已预加载<iostream>。" << endl;
	Sleep(2000);
	cout << "std:main,喏!cin、cout、endl……给你!" << endl;
	Sleep(1000);
	MessageBox(GetForegroundWindow(), _T("是否接受?"), _T("std"), 4);//弹出对话框
	Sleep(1000);
	cout << "旁白:萌新并没加上\"using namespace std;\"。" << endl;
	Sleep(2000);
	cout << "旁白:这位萌新写上了一句cout,并编译了一下。" << endl;
	Sleep(2000);
	cout << "系统:\"cout\":未声明的标识符" << endl;
	Sleep(2000);
	cout << "旁白:萌新一塌糊涂。" << endl;
	Sleep(2000);
	cout << "旁白:于是,萌新到网上搜了个代码,把你删掉了。" << endl;
	Sleep(2000);
	cout << "------------------------------------------------------First  Blood------------------------------------------------------";
	FadeAway();
	Sleep(2000);
	cout << "Windows.h:喏!Sleep、MessageBox……给你!" << endl;
	Sleep(1000);
	MessageBox(GetForegroundWindow(), _T("是否接受?"), _T("Windows.h"), 3);
	Sleep(1000);
	cout << "旁白:萌新并没加上\"#include <Windows.h>\"。" << endl;
	Sleep(2000);
	cout << "旁白:这位萌新写上了一句Sleep,并编译了一下。" << endl;
	Sleep(2000);
	cout << "系统:\"Sleep\":未声明的标识符" << endl;
	Sleep(2000);
	cout << "旁白:萌新一塌糊涂。" << endl;
	Sleep(2000);
	cout << "旁白:于是,萌新又到网上搜了个代码,把你删掉了。" << endl;
	Sleep(2000);
	cout << "------------------------------------------------------Double  Kill------------------------------------------------------";
	FadeAway();
	Sleep(2000);
	cout << "旁白:萌新又加了几句,并编译了一下。" << endl;
	Sleep(2000);
	cout << "系统:编译中……" << endl;
	Sleep(2000);
	cout << "系统:编译中……" << endl;
	Sleep(2000);
	cout << "系统:编译中……" << endl;
	Sleep(2000);
	cout << "系统:编译中……" << endl;
	Sleep(2000);
	cout << "系统:编译中……" << endl;
	Sleep(2000);
	cout << "旁白:于是,萌新以为又是你搞的鬼,双到网上搜了个代码,把你删掉了。" << endl;
	Sleep(2000);
	cout << "------------------------------------------------------Triple Kill------------------------------------------------------";
	FadeAway();
	Sleep(2000);
	ofstream out("save.txt");
	out << 1;//保存“1”在一个文档中,当用户再次开启这个程序时,程序就会知道自己不是第一次被打开。
	out.close();
	system("shutdown -r");
	cout << "旁白:萌新想做一个坑人游戏,于是写了一段关机代码并运行了。" << endl;
	Sleep(2000);
	cout << "系统:关机中……(重启后打开有彩蛋!)" << endl;
	Sleep(100000);
}
void s()
{
	cout << "--------------------------------------------------------YOU  DIE--------------------------------------------------------";
	Sleep(2000);
	cout << "-------------------------------------------------------Quadr Kill-------------------------------------------------------";
	FadeAway();
	Sleep(2000);
	cout << "然后没有然后了……" << endl;
	Sleep(2000);
	cout << "然后真的没有然后了……" << endl;
	Sleep(2000);
	cout << "但可以给你们讲一些坑人方式。" << endl;
	Sleep(2000);
	cout << "比如说我这个函数“楼下”的\"lock()\"函数就是先把控制台从任务栏隐藏,再禁用关闭键。" << endl;
	Sleep(2000);
	cout << "然后你的好朋友就会在打开程序的时候崩溃掉……" << endl;
	Sleep(2000);
	cout << "-------------------------------------------------------Penta Kill-------------------------------------------------------";
	FadeAway();
	Sleep(2000);
	cout << "还有,看到\"lock()\"“楼下”的\"check()\"了吗?" << endl;
	Sleep(2000);
	cout << "它是一检测到Alt被按下,就会清除输入缓冲区的数据,这是为了避免你的好朋友用Alt+F4强制关闭。然后……" << endl;
	Sleep(2000);
	cout << "-------------------------------------------------------Shut  Down-------------------------------------------------------";
	FadeAway();
	Sleep(2000);
	cout << "再告诉你们一个小秘密:我没做任何关于任务管理器的防护……但是,至少我没成功过……导致我重启了好几次……" << endl;
	Sleep(2000);
	cout << "------------------------------------------------------华丽的结束线------------------------------------------------------";
	ofstream out("save.txt");
	out << 0;//重置文档内容
	out.close();
}
void lock()//把控制台从任务栏隐藏,再禁用关闭键
{
	HWND hWnd = GetConsoleWindow();
	SetWindowLong(hWnd, GWL_EXSTYLE, WS_EX_TOOLWINDOW);
	HMENU hmenu = GetSystemMenu(hWnd, false);
	RemoveMenu(hmenu, SC_CLOSE, MF_BYCOMMAND);
	LONG style = GetWindowLong(hWnd, GWL_STYLE);
	style &= ~(WS_MINIMIZEBOX);
	SetWindowLong(hWnd, GWL_STYLE, style);
	SetWindowPos(hWnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
	ShowWindow(hWnd, SW_SHOWNORMAL);
	DestroyMenu(hmenu);
	ReleaseDC(hWnd, NULL);
}
DWORD WINAPI check(LPVOID lpParameter)
{
	while (1)
	{
		if (_getch() == 0x12)//如果按下Alt键,那么清除输入缓冲区内容。这是为了防止用户按下Alt+F4强制关闭
		{
			FlushConsoleInputBuffer(GetStdHandle(STD_INPUT_HANDLE));
		}
	}
	return 0L;
}
int main()
{
	HANDLE hThread = CreateThread(NULL, 0, check, NULL, 0, NULL);//开线程
	CloseHandle(hThread);
	lock();
	ifstream in("save.txt");
	in >> m;//检查是否第一次打开
	in.close();
	if (m == 1)
	{
		s();
	}
	else
	{
		f();
	}
	return 0;
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

H.Y_C ⁹⁹⁹⁹⁹⁹⁺

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值