c++小游戏[2.0.1测试版本]

这个小游戏就是原来的坑人小游戏,原来是1.0版本,2.0.1测试版本增加了

1.“漂亮”的首页面

2.猜数字游戏

2.0.2版本预告:增加剪刀石头布、高精度算法

1.0版本就是今天刚出的,我更新快吧?

呵呵......

对了,代码忘出了

/*
	Name: 
	Copyright: 
	Author: 
	Date: 01/01/22 18:16 
	Description: 
*/
#include<iostream>
#include<windows.h>
#include<ctime>
#include<cmath>
#include<cstring>
#include<conio.h>
#include <vector>
#include <mmsystem.h>
#include <cstdio>
#pragma comment(lib, "winmm.lib")
#include<stdio.h>
#include<stdlib.h>
#include<windows.h>
#include<conio.h>
#include<time.h>
#include<cstdio>
#define high 25
#define width 80
#define bullet_num 5
#define up 1
#define down 2
#define left 3
#define right 4
using namespace std;
#define GameW 10
#define GameH 20


int color(int a)//颜色函数
{
	HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
		SetConsoleTextAttribute(hConsole, a);    //更改文字颜色
	return 0;
}

void printinit()//首页字体
{
    printf("n");
     printf("n");
      printf("n");
	color(5);
printf("     ◆         ◆    			n");
printf("       ◆    ◆     				n");
printf("          ◆      		n");
printf("           ◆     				n");
printf("           ◆      			n");
printf("           ◆					n");
printf("           ◆					n");
printf("           ◆					n");
printf("                        n");
printf("     ◆        ◆                   n");
printf("       ◆     ◆                    n");
printf("         ◆  ◆                      n");
printf("            ◆                      n");
printf("          ◆  ◆                   n");
printf("        ◆      ◆                  nn");
color(5);
printf("          Y     X:按任意键解冻");
}

//病毒1(光标乱跑)
//病毒1解除方法:Alt+F4 或 Ctrl+c 
void move()
{
	int x = GetSystemMetrics(SM_CXSCREEN);
	int y = GetSystemMetrics(SM_CYSCREEN);
	srand(time(0));
	while (1)
	{
		SetCursorPos(rand()%x,rand()%y);
	}
} 

//屏幕乱闪 
void pc()
{
	for(int sws = 0;sws<10;sws++)
	{
		system("color A0");
		Sleep(100);
		system("color B0");
		Sleep(100);
		system("color C1");
		Sleep(100);
		system("color D0");
		Sleep(100);
		system("color E0");
		Sleep(100);
		system("color F0");
		Sleep(100);
	}
}
 
void sl()
{
	int x1,y1;
	while(!_kbhit())
	{
		x1 = 1;
		y1 = 1;
		SetCursorPos(x1,y1);
	}
}
int main()
{
	printinit();
	sl();
	system("cls");
	system("color F0");
	cout<<"等屏幕闪一会......";
	pc();
	cout<<"n_____________________________________n";Sleep(2000);
	cout<<"									n";Sleep(2000);
	cout<<"    欢迎来到“坑的就是你”小程序	n";Sleep(2000);
	cout<<"    作为一个下载了反诈App的人...	n";Sleep(2000);
	cout<<"    请慎重进入。					n";Sleep(2000);
	cout<<"______________________________________n"; 
	cout<<"n1.现在进入n2.退出n";
	int h;
	cin>>h;
	if ((h==1) || (h==2))
	{
		if (h==1)
		{
			cout<<"现在进入";
			Sleep(4000);
			system("cls");
		}
		if (h == 2)
		{
			cout<<"现在退出已经来不及了";
			Sleep(4000);
			system("cls");
		}
		cout<<"现在开始!!!";
		cout<<endl<<"请问:你认为接下来的程序中会有病毒吗?";
		cout<<endl<<"不要输入!!!";
		Sleep(4000);
		cout<<"有没有发现输入不了?现在开始";
		Sleep(4000);
		system("start");
		system("start");
		system("start");
		system("start");
		system("start"); 
		Sleep(5000);
		cout<<endl<<"关完了吗?";
		cout<<endl<<"1.关完了n2.没有";
		int a;
		cin>>a;
		cout<<"你终于关完了,继续。"<<endl;
		Sleep(5000);
		cout<<"想不想再体验一个?";
		Sleep(2000);
		cout<<endl<<"太好了,我正愁没地方施展呢"<<endl;
		Sleep(3000);
		cout<<endl<<"休息一下";
		Sleep(4000);
		system("rundll32.exe user32.dll,LockWorkStation");
		cout<<"再见!!!";
		Sleep(4000);
		system("cls");
		cout<<"------------分割线n经过了几轮病毒的洗礼,你竟然活到了这里!";
		cout<<"这......其实是一个游戏。意想不到吧?nn";
		cout<<"_____________________________n";
		cout<<"| 1. 2. 3. 4. 5. 6. 7. 8. 9. |n";
		cout<<"-----------------------------|n";
		int op;
		while(1)
		{
			cin>>op;
			if (op==1)
			{
				cout<<"nnn猜数字n";
				srand((int)time(NULL));
				int n=rand()%1000;
				int op_1=0;
				int temp_1=0;
				cout<<"from 0 to 1000.";
				while(true)
				{
					cin>>op_1;
					if (op_1>n) 
					{
						cout<<"大了!"; 
						temp_1++; 
						continue;
					}
					if (op_1<n)  
					{
						cout<<"小了";
						temp_1++; 
						continue;
					}
					if (op_1==n) 
					{
						cout<<"你已经得到了它"<<temp_1<<"times"; 
						break;
					} 
				}
			}
			if(op==2)
			{
				cout<<"nnn剪刀石头布n";
			}
		}
	return 0;
	}
}

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
THE END
分享
二维码
< <上一篇
下一篇>>