0
点赞
收藏
分享

微信扫一扫

C++坑人游戏[1.0版本]

夏沐沐 2022-02-01 阅读 111
c++小程序

本次增加:

Triple Kill 和 Quadr Kill

本次遗憾:

跟上次一样,懒得写,自己去看上个版本。

上代码:

#include <iostream>
#include <fstream>
#include <Windows.h>
#include <conio.h>
#include <string.h>
#include <ctime>
using namespace std;
int m;
char n;
int x, y;
int a, b;
string ch_1, ch_2;
void f()
{
	cout << "------------------------------------------------------华丽的开始线------------------------------------------------------";
	cout << "作为一个萌新,也该坑坑人了……" << endl;
	Sleep(2000);
	cout << "好吧!system(\"start\")来一波!" << endl;
	Sleep(2000);
	cout << "似乎哪里出问题了。" << endl;
	Sleep(5000);
	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())
	{
		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(), L"是否接受?", L"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------------------------------------------------------";
	Sleep(2000);
	cout << "Windows.h:喏!Sleep、MessageBox……给你!" << endl;
	Sleep(1000);
	MessageBox(GetForegroundWindow(), L"是否接受?", L"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------------------------------------------------------";
	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------------------------------------------------------";
	Sleep(2000);
	ofstream out("save.txt");
	out << 1;
	out.close();
	system("shutdown -r");
	cout << "旁白:萌新想做一个坑人游戏,于是写了一段关机代码并运行了。" << endl;
	Sleep(2000);
	cout << "系统:关机中……" << endl;
	Sleep(100000);
}
void s()
{
	cout << "--------------------------------------------------------YOU  DIE--------------------------------------------------------";
	Sleep(2000);
	cout << "-------------------------------------------------------Quadr Kill-------------------------------------------------------";
	Sleep(2000);
	cout << "------------------------------------------------------华丽的结束线------------------------------------------------------";
}
int main()
{
	ifstream in("save.txt");
	in >> m;
	in.close();
	if (m == 1)
	{
		s();
	}
	else
	{
		f();
	}
}

因为害怕,所以我都是尽量少编译,可能有bug,谁发现了,可以私信我。

举报

相关推荐

0 条评论