#include <iostream>
#include <map>
#include <string>
//This is just an example function, you process something and
//we assume it return 3
int doSomething()
{
return 3;
}
int main()
{
std::map<int, std::string> myMap;
//Assume your code process something and then, your map look like this:
//(it will be different on each time the program is run)
myMap[0] = "first";
myMap[1] = "second";
myMap[2] = "third";
bool isOK = true;
while (isOK)
{
//Notice that doSomething() is a dynamic function,
//I just assume that this time it return value = 3
int key = doSomething();
if (myMap[key] == "someThingWeWant")
{
//Do something
std::cout << "someThingWeWant\n";
}
else
{
//Do something
std::cout << "not someThingWeWant\n";
}
isOK = false;
}
//More code here continue process with myMap
return 0;
}