问题标题: 酷町堂:董氏游戏2.0版本来了┏(^0^)┛!

0
0
已解决
董宇昊
董宇昊
初级启示者
初级启示者

#include<bits/stdc++.h>
#include<cstdlib>
#include<ctime>
#include<windows.h>
using namespace std;
int yx1(){
    string k;
    int f=0,f2=100;
    k="欢迎来到猜数游戏!每个数在1~100之间";
    cout<<k<<"\n";
    int a; 
    srand(time(NULL));
    a=rand()%100+1;
    int b;
    k="猜测吧,孩子!";
    cout<<k<<endl; 
    Sleep(1000);
    system("cls");
    while(1){
        cin>>b; 
        if(b>a) k="猜大了!";
        else if(a>b) k="猜小了!";
        else if(a==b) k="猜中了!"; 
        f++;
        f2-=10;
        cout<<k<<"\n";
        Sleep(1000);
        if(b==a){
            cout<<"你一共猜测了"<<f<<"次\n"; 
            cout<<"幸运值:"<<f2;
            return 0;
        }
        if(f2==0){
            cout<<"你一共猜测了10次\n";
            cout<<"幸运值:0";
            return 0; 
        }
    }
}
/*int yx2(){
    
}*/
int main(){
    string k;
    k="欢迎来到董氏游戏~祝你游戏愉快!";
    cout<<k<<endl;
    k="你想玩什么游戏?";
    cout<<k<<endl; 
    cout<<"1.猜数游戏 2. \n";
    int yx;
    cin>>yx;
    k="正在加载资源~请稍后";
    if(yx==1){
        for(int i=1;i<=100;i+=2){
            cout<<k<<endl;
            cout<<"已完成%"<<i;
            Sleep(100);
            system("cls");
        }
        yx1();
    } 
    /*if(yx==2){
        cout<<k;
        for(int i=1;i<=100;i+=2){
            cout<<k<<endl;
            cout<<"已完成%"<<i;
            Sleep(100);
            system("cls");
        }
        yx2();
    }*/
    return 0;
}

//大家先别点2,2还正在开发


0
已采纳
胡钰妍
胡钰妍
资深光能
资深光能

666666666666666666666666666好玩好玩好玩好玩好玩好玩好玩好玩好玩好玩好玩----------------望采纳!!!!!

0
0
我要回答