#is there any way to check if a string is in any variable and print that variable?

10 messages · Page 1 of 1 (latest)

charred knoll
#

nya

fresh whaleBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

charred knoll
#

or change that variable?

#
int meow = 3;
int woof = 5
int nya = 2

cin >> rawr;

/* how would I know if rawr is equal to any of those variables to change them without writing 3 if statements? */
#

and change that variable

hushed wind
#

There is no automatic "give me a list of all variables" function in C++. You can make an std::vector<int *>, put all the ints in there and then search it. Or maybe std::map<std::string, int> would help your use-case.

#

Debuggers and such have some functions to search through the RAM, but unless you search for something longer and more unique than 3 you'll have a ton of hits in places you don't care about.

charred knoll
#

thats fully reasonable i see i see

#

thank you!

#

!solved