如上题所述
#include<bits/stdc++.h>
using namespace std;
int randnum(int n){
srand((unsigned int)time(NULL));
n=rand()%3+1;
return n;
}
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
while(1){
cout<<"game start\n";
cout<<"1=剪刀\n";
cout<<"2=石头\n";
cout<<"3=布\n";
int num1;
cin>>num1;
int num2=randnum(num2);
if(num1=num2) cout<<"draw!\n";
else if(num1>num2){
if(num1=2) cout<<"win\n";
else if(num2=1){
cout<<"game over\n";
}
}
else{
if(num1=2) cout<<"game over\n";
else if(num2=1){
cout<<"win\n";
}
}
cout<<"again?1=true 0=false\n";
bool m;
cin>>m;
if(m==0) return 0;
system("cls");
}
return 0;
}