当前位置 博文首页 > pzjdsg666的博客:C++:又是一个小游戏
#include<bits/stdc++.h>
using namespace std;
long long a,b,c,d,x,n;
int main(){
system("color 1D");
srand(time(0));
while(1){
a=rand()%3+1,b=rand()%3+1;
cout<<"请选择:(1至3)"<<endl;
cin>>n;
while(b==a&&b==n)
b=rand()%3+1;
cout<<b<<"号是兔子,请问您要改变选择吗?(1改变,0不改变)"<<endl;
cin>>d;
if(d==1){
if(n!=a){
x++;
cout<<"正确!得分:"<<x<<endl;
} else{
cout<<"错误!得分:"<<x<<endl;
return 0;
}
} else{
if(n==a){
x++;
cout<<"正确!得分:"<<x<<endl;
} else{
cout<<"错误!得分:"<<x<<endl;
return 0;
}
}
}
return 0;
}
?