老虎机3.0 Pro+

leo1009 2026-08-19 11:25:13

#include<bits/stdc++.h>
#include<conio.h>
using namespace std;
double n,money=100;
bool flag=false;
string s[10]={"菠萝","香蕉","草莓","柠檬","葡萄","西瓜","橙子","椰子"};
int main(){
	n=100;
	cout<<"~欢迎来到老虎机~"<<endl;
	label1:
	double o,times=0;
	while(n>0){
        cout<<"请输入押金(押金越多奖金越多)\n(按下ESC键退出)\n"; 
        int key=_getch();
        if(key==27){
        	return 0;
        }
		cin>>key;
		times++;
		char a=abs(rand()%8);
		char b=abs(rand()%8);
		char c=abs(rand()%8);
		system("cls");
		cout<<"下面是中奖结果: "<<endl<<s[a]<<"  "<<s[b]<<"  "<<s[c]<<endl;
		if(a==b && a==c){
			if(flag){
				cout<<"\n恭喜您中奖了!!!奖金:"<<(o+o*6/1.2+times)*3<<"\n";
				n+=(o+o*6/1.2+times)*3;
				flag=false;
			}else{
			cout<<"\n恭喜您中奖了!!!奖金:"<<o+o*6/1.2+times<<"\n";
			n+=o+o*6/1.2+times;
		}
		}else if(times>=15 && !flag){
			cout<<"疯狂模式!!!(中奖金额翻三倍)\n";
			flag=true;
			times=0;
		}else{
			n-=o;
		}
		cout<<"剩余mop: "<<n<<"\n";
	cout<<"\n很抱歉,您的余额不足,请充值!!!\n";
	label2:
	system("cls");
	cout<<"\n剩余$"<<money<<"\n";
	cout<<"---------------\n|100$ = 150mop|\n|300$ = 450mop|\n|500$ = 750mop|\n---------------\n";
	double z;
	cin>>z;
	if(money<=0){
		return 0;
	}
	if(z<=money){
		cout<<"充值成功!!!\n";
		n+=z*1.5;
		money-=z;
		cout<<"\n剩余$"<<money<<"\n";
		goto label1;
	}else{
		cout<<"您的余额不足!!!\n";
		goto label2;
	}
	system("cls");
	}
	return 0;
}