#include <iostream>
#include <ctime>
#include <cstdlib>
using namespace std;
int main(int argc, char** argv) {
    /*int x,y,n,ans=0;
    for(int i=50;i<=60;i++){
        x=i%10;
        y=i/10;
        n=x*10+y;
        if(i+n<100)ans++;
        
    }
    cout<<ans<<endl;*/
    const int MAX=10;
    srand(time(0));
    int m,n,countm,countn;
    countn=countn=0;
    for(int i=0;i<MAX;i++){
        m=rand()%3+1;
        cout<<"请你出招"<<endl;
        cout<<"1.剪刀2.石头3.布"<<endl;
        cin>>n;
        if(n<1||n>3)
            cout<<"请输入1-3此局无敌"<<endl;
            else{
                switch(m-n){
                    case-2:
                    case 1:cout<<"计算机赢!"<<endl;countm++;break;
                    case 0:cout<<"平局!"<<endl;break;
                    default:cout<<"你赢!"<<endl;countm++;break;
                    
                }
            }
        }
        cout<<"计算机赢"<<countm<<endl;
        cout<<"你赢"<<countn<<endl;
    return 0;
}

 

posted on 2023-07-10 09:46  爱吃泡面的皮卡  阅读(16)  评论(0编辑  收藏  举报