同样,不说废话,放代码
#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;
}
可以随机打开网页
来源:CSDN
作者:philosophy of scienc
链接:https://blog.csdn.net/m0_46258567/article/details/104611583