改编自(SunnyLHY)的老虎机2.0pro
leo1009
2026-08-03 19:30:08
2026-08-27 18:05:15
#include<bits/stdc++.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";
cin>>o;
times++;
int a=abs(rand()%8);
int b=abs(rand()%8);
int c=abs(rand()%8);
system("cls");
cout<<"下面是中奖结果: "<<endl<<s[a]<<" "<<s[b]<<" "<<s[c]<<endl;
if((a+b+c)/3==a && (a+b+c)/3==b && (a+b+c)/3==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 c;
cin>>c;
if(money==0){
return 0;
}
if(c<=money){
cout<<"充值成功!!!\n";
n+=c*1.5;
money-=c;
cout<<"\n剩余$"<<money<<"\n";
goto label1;
}else{
cout<<"您的余额不足!!!\n";
goto label2;
}
system("cls");
return 0;
}
共 3 条回复
不知道为什么,我原来的代码是很工整的,但只要一发布就会变成这样
+1
能工整一点吗