using namespace std; int main(){
char fhjs;
int fhb=0;
int yyy=10;
int t=50;
int a=rand()%100;
int b=rand()%100;
int ans=0;
int c;
int jf=0;
char pop;
cout<<"按o进入商城,按l进入试炼"<<endl;
cin>>pop;
if(pop=='l'){
while(t>=0){
cout<<"第"<<ans<<"题"<<endl;
cout<<"当前积分:"<<jf<<endl;
cout<<"复活币:"<<fhb<<endl;
cout<<"失败机会:"<<yyy<<endl;
cout<<a<<'+'<<b<<'=';
cin>>c;
if(a+b==c){
cout<<"蒸蚌!!!"<<endl;
ans++;
}
else{
cout<<"这都不会???菜就多练!!!!"<<endl;
ans++;
}
if(ans/10==0){
jf++;
cout<<"积分加1!";
}
t--;
}
}
else if(pop=='o'){
t=50;
char j;
while(t>0){
cout<<"hi,这里是商城"<<endl ;
cout<<"1、复活币(20积分)按k购买"<<endl;
cout<<"按q退出!"<<endl;
cin>>j;
if(j=='k'){
cout<<"购买成功!"<<endl;
jf-=20;
fhb++;
}
else if(j=='q'){
break;
}
else{
cout<<"积分不足!"<<endl;
}
}
}
t=50;
while(t>=0){
cout<<"第"<<ans<<"题"<<endl;
cout<<"当前积分:"<<jf<<endl;
cout<<"复活币:"<<fhb<<endl;
cout<<"失败机会:"<<yyy<<endl;
cout<<a<<'+'<<b<<'=';
cin>>c;
if(yyy=0){
cout<<"Game over";
if(yyy>0){
cout<<"是否使用复活币?(按wy使用)";
cin>>fhjs;
if(fhjs=='wy'){
cout<<"复活成功!";
yyy=10;
continue;
}
else{
cout<<"你失败了!";
break;
}
}
else if(yyy==0){
cout<<"你失败了!";
break;
}
}
if(a+b==c){
cout<<"蒸蚌!!!"<<endl;
ans++;
}
else{
cout<<"这都不会???菜就多练!!!!"<<endl;
ans++;
yyy--;
}
if(ans/10==0){
jf++;
cout<<"积分加1!";
}
t--;
}
return 0;
}
1、商店只能开一次 2、只有50次答题机会 3、做错一次失败机会就变成-1了
比赛已结束。