⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 赌博游戏1.cpp

📁 一个用C++做的小游戏-赌博游戏,很简单.有SHOWHAND,玩色子等.对初学C++的人,希望能帮助你们更好的理解运用C++的基础知识
💻 CPP
字号:
#include "head.h"
void func1()

{system("cls");
	char ans,answer,quit;
    double t[3],sum,x=1000,m;
    cout<<setw(45)<<"~.~*~~.~ThIs Is A gAmBlE gAmE~.~~*~.~"<<'\n'<<setw(70)<<"GeT iN? EnTeR y,NoT eNtEr n...."<<'\n'<<"your choic:"<<endl;
	ans=getchar();//选择游戏的开始
	system("cls");//清屏
	if(ans=='y')
	{ 
		cout<<setw(42)<<"=*=>>GAME START<<=*="<<'\n'<<setw(41)<<"$$$A ludo game$$$"<<endl;
		cout<<setw(70)<<"bet:"<<"$"<<x<<endl;
		do
		{
			srand(time(0));
			{
				do {t[1]=rand();}
				while(t[1]<1||t[1]>6);
				
				do {t[2]=rand();}
				while(t[2]<1||t[2]>6);
				
				do {t[3]=rand();}
				while(t[3]<1||t[3]>6);
			}
			sum=t[1]+t[2]+t[3];//三个色子的数字和
			cout<<setw(55)<<"The Dice num: [* * *]"<<endl;
			cout<<setw(45)<<"Bet? At lEasT $100"<<'\n'<<"Bet=$";
			cin>>m;//输入赌注
			while(m<100)
			{ cout<<"At least $100,please~!!!"<<endl;
			cout<<"BeT=$";
			cin>>m;
			if(m<100){cout<<"sorry,you are not able to play this.KiCk OuT~!";exit(0);}
			}
			while(m>x)
			{cout<<"ThAt'S oVeR yOuR aCcOuT,pLeAsE iNsErt AgAin>>>\tBeT=$";
			cin>>m;         
			if(m>x)
			{cout<<"YoU aRe Not ObEyInG tHe RuLe...\t~KicK oUt~\n";exit(0);}
			}
			if(m>=100&&m<=x)
			{ if(m==x){cout<<setw(20)<<"YoU aRe So BraVe,Go fOr tHe GlOVeS...SeE yOuR lUcK~.."<<'\n';}
			x=x-m;//所拥有的资金数
			cout<<setw(70)<<"Bet:"<<"$"<<x<<endl;
			cout<<"Big or Small? just input'b'or's'..."<<'\n'<<"ans:";
			cin>>answer;//选择大或小的输入
			if((answer=='b'&&sum>=10&&sum<=18)||(answer=='s'&&sum<10&&sum>=3))
			{x=x+(2*m);
			cout<<setw(70)<<"Bet:"<<"$"<<x<<'\n';
			cout<<setw(52)<<"^_^>>W i N<<^_^"<<'\n'<<"dice sum="<<sum<<'\n'<<"you guess:"<<answer<<endl;
			if(x>=10000)
			{cout<<setw(48)<<"???          ???"<<'\n';
			cout<<setw(52)<<"??         ???        ??"<<'\n';
			cout<<setw(53)<<"??          |||         ??"<<'\n';
			cout<<setw(53)<<"??     =^= *   * =^=    ??"<<'\n';
			cout<<setw(52)<<"??      *   *   *     ??"<<'\n';
			cout<<setw(51)<<"??      *     *     ??"<<'\n';
			cout<<setw(50)<<"??       *|*      ??"<<'\n';
			cout<<setw(48)<<"??            ??"<<'\n';
			cout<<setw(46)<<"??        ??"<<'\n';
			cout<<setw(45)<<"??    ??"<<'\n';
            cout<<setw(42)<<"??"<<endl;
			cout<<'\n';
			cout<<'\n';
			cout<<'\n';
			_cputs("~YoU aRe So GoOd~What a lucky guy?..? PlEaSe StOp & HiT oN tHe RoAd HoMe.....>>>");
			 exit(0);
			}
			}
			else 
			{cout<<setw(52)<<">_<--L o S e-->_<"<<'\n'<<" Dice sum="<<sum<<'\n'<<"you guess:"<<answer<<'\n';
			if(x<=0)
			{cout<<"You have zore in your accout,welcome next time...^_^";
			exit(0);
			}
			} 
			}
			else if(cin>>quit)exit(0);
		}while(x<=10000);
	}
	else(ans='n')
		;{cout<<"welcome next time..byebye...";
	exit(0);
	}
	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -