C++:自创小游戏

欢迎来玩,每次都有不一样的结果。

长达142行。

cpp 复制代码
#include<bits/stdc++.h>
#include<windows.h>
#define random(a,b) (rand()%(b-a+1)+a)
using namespace std;
int main(){
	int n;
	cout<<"输1~10,越小越好,不告诉你有什么用,当然也可以输入密码5963"<<endl; 
	cin>>n;
	Sleep(3000);
	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<<"(@_@)"<<endl;
	Sleep(2000);
	cout<<"/^o^/"<<endl;
	Sleep(2000);
	cout<<"|0<>0|"<<endl;
	Sleep(2000);
	cout<<"你喜欢哪个?你喜欢哪个?你喜欢哪个?你喜欢哪个?你喜欢哪个?你喜欢哪个?你喜欢哪个?你喜欢哪个?"<<endl;
	cout<<"你喜欢哪个?你喜欢哪个?你喜欢哪个?你喜欢哪个?你喜欢哪个?你喜欢哪个?你喜欢哪个?你喜欢哪个?"<<endl;
	cout<<"你喜欢哪个?你喜欢哪个?你喜欢哪个?你喜欢哪个?你喜欢哪个?你喜欢哪个?你喜欢哪个?你喜欢哪个?"<<endl;
	cout<<"你喜欢哪个?你喜欢哪个?你喜欢哪个?你喜欢哪个?你喜欢哪个?你喜欢哪个?你喜欢哪个?你喜欢哪个?"<<endl;
	cout<<"你喜欢哪个?你喜欢哪个?你喜欢哪个?你喜欢哪个?你喜欢哪个?你喜欢哪个?你喜欢哪个?你喜欢哪个?"<<endl;
	cout<<"你喜欢哪个?你喜欢哪个?你喜欢哪个?你喜欢哪个?你喜欢哪个?你喜欢哪个?你喜欢哪个?你喜欢哪个?"<<endl;
	Sleep(8000);
	cout<<"(○`(●●)′○)ノ 像xxx"<<endl;
	Sleep(5000);
	cout<<"不要生气了,看看这个呢?"<<endl;
	Sleep(3000);
	cout<<"( ̄(●●) ̄) "<<endl;
	Sleep(3000);
	cout<<"(~ ̄(OO) ̄)ブ"<<endl;
	Sleep(3000);
	cout<<"( ̄▽ ̄)~*       O(∩_∩)O哈哈~"<<endl; 
	cout<<"  **"<<endl;
	cout<<" ****"<<endl;
	cout<<"******"<<endl;
	cout<<" ****"<<endl;
	Sleep(5000);
	cout<<"   *"<<endl;
	cout<<"  *  "<<endl;
	cout<<"   *"<<endl;
	cout<<"  *"<<endl;
	Sleep(5000);
	cout<<"你刚才输入的数:"<<n<<endl;
	if(n>=5&&n<=10){
		cout<<"你是猪"; 
	}
	if(n<5&&n>=1){
		cout<<"你是狗"; 
	} 
	int a=0;
	if(n==0){
		cout<<"幸运儿,你准备好了吗?"<<endl;
		Sleep(3000);
		cout<<"   *   "<<endl;
		cout<<" **** **                    *" <<endl;
		cout<<"**********   万箭齐发! ******xxx"<<endl;  
		cout<<"  * * **                    *"<<endl;
		cout<<"  * *"<<endl;
		cin>>a; 
		cout<<"触发宇宙爆炸!";
		Sleep(1000); 
		cout<<"宇宙即将爆炸!";
		Sleep(300);
		if(a==0){
			Sleep(400);
			cout<<"宇宙已经爆炸,没有机会,你已死亡!"; 
		}
		else if(a>0&&a<=10){
			Sleep(1001);
			cout<<"机会很低!";
			Sleep(200);
			srand((unsigned)time(NULL)); 
			cout<<"逃跑分钟:"<<random(1,6); 
			}
		else{
			Sleep(1250);
			cout<<"机会很大!"; 
			Sleep(300);
			srand((unsigned)time(NULL));
			cout<<"逃跑分钟:";
			Sleep(500);
			cout<<" "<<random(10,20);
			cout<<" "<<"只要不作死,就能活。"; 
		}
	} 
	if(n==5963){
		cout<<"猜数游戏(1-100)"<<endl;
		srand(time(NULL));
		int key=rand()%100+1;
		for(int i=1;i<=7;i++)
		{
			int x;
			cout<<"请输入一个数字:";
			cin>>x;
			if(x<key)
			{
				cout<<"小了"<<endl;
			} 
			if(x>key)
			{
				cout<<"大了"<<endl;
			} 
	    	if(x==key)
			{
				cout<<"恭喜您,猜对啦!"<<endl;
				Sleep(1500);
		    	cout<<"进入下一个游戏。";
				    int w;
					cout<<"请输入一个1~5:"; 
					cin>>w;
					switch(w) 
					{
					case 1:cout<<"没有中奖"<<endl;break;
					case 2:cout<<"中奖了"<<endl;break; 
					case 3:cout<<"中奖了"<<endl;break; 
					case 4:cout<<"没有中奖."<<endl;break; 
					case 5:cout<<"没有中奖."<<endl;break; 
				    default:cout<<"无事发生。"<<endl;break;
				    Sleep(500);
				    cout<<"Game Over!!!O(∩_∩)O哈哈~";
					return 0; 
				} 
			} 
		}
		cout<<"7次机会已用完,很遗憾,未猜对!"<<endl;
		cout<<"正确数字是:"<<key<<endl;
	} 
	return 0;
}

创作不易,希望大家关注三连!!!

相关推荐
会跑的兔子23 分钟前
Android 16 Kotlin协程 第一部分
android·开发语言·kotlin
Js_cold37 分钟前
Verilog函数function
开发语言·fpga开发·verilog
我是苏苏40 分钟前
C#基础:如何从现有类库复制一个新的类库,并且加入解决方案
开发语言·c#
算法与编程之美1 小时前
理解Java finalize函数
java·开发语言·jvm·算法
怕什么真理无穷1 小时前
C++面试4-线程同步
java·c++·面试
lkbhua莱克瓦241 小时前
Java基础——常用算法5
java·开发语言·笔记·github
cs麦子1 小时前
C语言--函数(function)
c语言·开发语言
snowfoootball1 小时前
python函数及面向过程高级特性
开发语言·python
是苏浙1 小时前
零基础入门C语言之C语言实现数据结构之顺序表
c语言·开发语言·数据结构
代码雕刻家1 小时前
C语言中关于类型转换不匹配的解决方案
c语言·开发语言·算法