How can I add containers such as list, Map/set and stack/queue to my code?

How can I replace the string function to queue/ priority queue in a code?

String function to change:

string people[3] = {"Noah",
"Lily",
"Marcus",
};
Last edited on
What you posted isn't a function, it's an array.

its hard to say without moar code but likely you use the array as a lookup table in a somewhat function-like manner. That is about as efficient as it gets, but if you need to exchange it, the most direct swap out is likely an unordered map or vector. can you explain exactly what you want to do with some more words and code? Right now it sounds like "i just discovered containers and wonder how to use them" but without a clear problem to solve? That is ok, you can play with anything if that is the goal, but tell us that or whatever so we can know what you need.

for a vector:
#include<vector>
vector<string>people{"No", "Li", "Ma"};
Last edited on
Topic archived. No new replies allowed.