其他分享
首页 > 其他分享> > 猜数字小游戏

猜数字小游戏

作者:互联网

#include <bits/stdc++.h>
#include <windows.h>

//linux版 #include <unistd.h>
using namespace std;
int main()
{
    srand(time(NULL));
    int a=rand()%10000-1;
    int b;
    srand(time(NULL));
    long long c=rand()%100000000000000000-1;
    srand(time(0));
    cout<<a-rand()%100-1<<"~"<<c<<endl;
    while(cin>>b)
    {
        if(a==b)
        {
            cout<<"牛逼!"; 
            //WINDOWS 版 /*MessageBox(NULL,"牛逼!","牛逼!",MB_OK or MB_ICONQUESTION or MB_SYSTEMMODAL or MB_ICONWARNING);*/
            break;
        }
        
        else if(a>b)
        {
            cout<<"小了!\n";
        }
        else if(a<b)
        {
            cout<<"大了!\n";
        }    
    }
    Sleep(10000);
    return 0;
}

标签:include,数字,MB,int,srand,小游戏,NULL,cout
来源: https://blog.csdn.net/qq_51709255/article/details/122755434