用c++写的无聊小游戏

左心房为你撑大大i 提交于 2020-03-02 16:59:02

同样,不说废话,放代码

#include<iostream>
#include<cstdio>
#include<iomanip>
#include<cstdlib>
#include<cmath>
#include<ctime>
#include<windows.h>
using namespace std;
int main()
{
    long long a;
    srand(time(NULL));
    a=rand()%10+0;
    cout<<a;
    switch(a)
    {
        case 1:ShellExecute(NULL,"open","www.bilibili.com",NULL,NULL,SW_SHOWNORMAL);break;
        case 2:ShellExecute(NULL,"open","www.baidu.com",NULL,NULL,SW_SHOWNORMAL);break;
        case 3:ShellExecute(NULL,"open","www.csdn.net",NULL,NULL,SW_SHOWNORMAL);break;
        case 4:ShellExecute(NULL,"open","www.acfun.cn",NULL,NULL,SW_SHOWNORMAL);break;
        case 5:ShellExecute(NULL,"open","www.github",NULL,NULL,SW_SHOWNORMAL);break;
        case 6:ShellExecute(NULL,"open","www.un.org",NULL,NULL,SW_SHOWNORMAL);break;
        case 7:ShellExecute(NULL,"open","www.360.com",NULL,NULL,SW_SHOWNORMAL);break;
        case 8:ShellExecute(NULL,"open","www.bing.com",NULL,NULL,SW_SHOWNORMAL);break;
        case 9:ShellExecute(NULL,"open","www.apple.com",NULL,NULL,SW_SHOWNORMAL);break;
        case 10:ShellExecute(NULL,"open","www.microsoft.com",NULL,NULL,SW_SHOWNORMAL);break;
        default:cout<<"意料之外";
    }
    if(a%2==0) system("color 4A");
    else system("color 2F");
    cout<<"OK";
    return 0;
}

可以随机打开网页

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!