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;
}

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

相关推荐
未来之窗软件服务8 分钟前
人体肢体渲染-一步几个脚印从头设计数字生命——仙盟创梦IDE
开发语言·ide·人工智能·python·pygame·仙盟创梦ide
Echo``15 分钟前
40:相机与镜头选型
开发语言·人工智能·深度学习·计算机视觉·视觉检测
摄殓永恒25 分钟前
猫咪几岁
数据结构·c++·算法
lisw0533 分钟前
R语言的专业网站top5推荐
开发语言·r语言
清同趣科研33 分钟前
扩增子分析|R分析之微生物生态网络稳定性评估之节点和连接的恒常性、节点持久性以及组成稳定性指数计算
开发语言·r语言
纨妙1 小时前
python打卡打印26
开发语言·python
.小墨迹1 小时前
Apollo学习——键盘控制速度
linux·开发语言·c++·python·学习·计算机外设
似水এ᭄往昔1 小时前
【数据结构】——队列
c语言·数据结构·c++·链表
烛九_阴1 小时前
【C++】解析C++面向对象三要素:封装、继承与多态实现机制
c++
qqxhb2 小时前
零基础学Java——第十一章:实战项目 - 微服务入门
java·开发语言·spring cloud·微服务