I have a small python script that opens a url built up from a string input byt the users and a pre-defined variable, which looks like this;
sn = str(input("Input here"))
url = 'http://URLPART1' + sn + '.URLPART2'
if sys.platform == 'win32':
webbrowser.open_new_tab(url)
elif sys.platform == 'darwin': # OSX
subprocess.Popen(['open', url])
Now, I'm trying to write the Windows part in C++ and I've tried a few different approaches but I'm not quite sure how to concatenate the strings in C++ as I did in python using '+'.
This is one of my attemps;
int main ()
{
int sn;
string sn2, url;
cout << "UserInputHere: ";
cin >> sn;
sn2 += std::to_string(sn);
std::string A = ("http://myurl1");
std::string B = (".myurl2");
url = A + sn2 +B; // or url << A + sn2 << B?
ShellExecute(NULL, "open", 'url', NULL, NULL, SW_SHOWNORMAL);
return 0;
}
Can someone show me how to re-write the line; std::string url = A + sn + B; into something C++ will understand or maybe the whole approach is wrong?
Many thanks,
Editted.