i want to write such a program in which a function will take a key and will give out the corresponding statements
graphically something like this
Key----- (refer this statements and ----------->{ "hi","hello",holla"}
display any one
of them randomly)
second key--------------->{other statements}
other key----------------> {other statements}
i tried the STL mapping technique but i guess it only works for "one key one data"
any idea how to start with this at least give a kick start or if it is possible with mapping then how??
1) You could use std::map with a string for a key and a vector of strings as the value.
When you find a match on the map key, you could then randomly select one of the strings in the vector.
std::map <string, vector<string>> mymap;
2) You could use a std::multimap. multimap allows multiple values for the same key. When you find a match on the key, you would have to iterate through the matches and select one.