跳转网站任意网站
2025-09-13 22:49:17
发布于:浙江
#include<iostream>
#include<string>
#include<windows.h>
using namespace std;
void f(const string& url) {
ShellExecuteA(NULL,"open",url.c_str(),NULL,NULL, SW_SHOWNORMAL);
}
int main() {
string url="https://m.baidu.com";
cout<<"超链接: "<<url<<endl;
cout << "是否要在浏览器中打开(y/n):";
char c;
cin>>c;
if(c=='y'||c=='Y') {
#ifdef _WIN32
f(url);
cout<<"正在浏览器中打开..."<<endl;
#else
cout << "自动打开功能仅在Windows平台支持"<<endl;
#endif
}
}
这里空空如也
有帮助,赞一个