-3

I'm making sort of a program bookmarker thing, where the user can create bookmarks, and later easily open them using my program. (Sort of like a more time consuming way of making shortcuts if you will). My problem is with the list of programs that the user can add to. How do I make this a dynamic menu? I want it to update when the user adds a program to it (A Steam game or application), and be able to access it once again with their newly added program there. Some of my horrible code: else if (userProgSelection == "1") { cout << "Enter the app ID (CS:GO = 730)" << endl; int userAppID; cin >> userAppID; cout << "And what is the name of this application?" << endl; string userAppName; cin >> userAppName; }

At this point the user has inputted the AppID for their Steam game (which I can use to call with Shell Execute) ShellExecute(NULL, "open", "steam://rungameid/730", NULL, NULL, SW_SHOWDEFAULT);

BUT, my problem is not this. My problem is the main programs that is meant to appear after the program is "added". If I could please have a simple way to do this? Something that would have a similar effect to this line (which obviously doesn't work, but its for you to understand my problem) mainmenutext = mainmenutext + userAppID + userAppName;

Wai Ha Lee
  • 8,598
  • 83
  • 57
  • 92
m0ite
  • 3
  • 4

1 Answers1

0

As mentioned in the comments, you need to use to_string to convert the int to string first:

mainmenutext += std::to_string(userAppID) + userAppName;
Emil Laine
  • 41,598
  • 9
  • 101
  • 157
  • to_string was not declared in this scope? – m0ite Nov 07 '15 at 13:32
  • 1
    You're using an old version of C++. `to_string` is only available in C++11 and later. Add `-std=c++14` (or `-std=c++11`) to the compiler flags. – Emil Laine Nov 07 '15 at 13:33
  • I changed userAppID cin to a string, as it is not actually needed to be an int. And to_string isn't available on my compiler atm, ill look into that, cheers for the help everyone. – m0ite Nov 07 '15 at 13:41