// main.cpp
// asdf
//
// Created by MoclifFood on 2024/12/22.
//
#include <iostream>
using namespace std;
int main() {
int times=0;
while(1){
cout<<"--------------------"<<endl;
cout<<"输入你要一次性开多少盒子:";
int god=0, baozhu=0, jianghun=0, shishi_strong=0, shishi_ruo=0, shishi_skin=0, jingpin=0;
int num=0;
cin>>num;
times+=num;
cout<<"开箱啦!!!"<<endl;
for(int i=1;i<=num;i++){
int reward=rand()%100000+1;
if(reward>=1 && reward<=5) god++;
else if(reward>=6 && reward<=10) baozhu+=66;
else if(reward>=11 && reward<=25) shishi_strong++;
else if(reward>=26 && reward<=75) shishi_ruo++;
else if(reward>=76 && reward<=150) shishi_skin++;
else if(reward>=151 && reward<=225) jianghun+=1000;
else if(reward>=226 && reward<=725) baozhu++;
}
cout<<"RESULT:"<<endl;
cout<<"--------------------"<<endl;
cout<<"神将:"<<god<<endl;
cout<<"宝珠:"<<baozhu<<endl;
cout<<"史诗武将(强):"<<shishi_strong<<endl;
cout<<"史诗武将(弱):"<<shishi_ruo<<endl;
cout<<"史诗皮肤:"<<shishi_skin<<endl;
cout<<"将魂:"<<jianghun<<endl;
cout<<"--------------------"<<endl;
cout<<"这是你第"<<times<<"开箱!"<<endl;
cout<<"--------------------"<<endl;
}
return 0;
}
标签:main,三国,cout,int,num,开箱,&&,reward,模拟
From: https://www.cnblogs.com/MoclifFood/p/18622648