map<string, int> is essentially an associative array (also called a dictionary).
it is essentially the opposite of vector<string>. so instead of indexing with ints ie:
myvec[0], myvec[1], myvec[2], ... it would be
mymap["a string"] = some_value
edit: you would need both, and <map>. also this looks like heavy stl stuff. User LB (his name on the forum is L B) would know more about this than me
A map is a key-value pair. The first item is the key, the second item is a value. It makes it very quick to look-up the value if you have the key.
In your case:
1 2 3 4 5 6
map<string,int> m = // if you have a string, it finds the integer value for you
{{ "zero", 0 }, // Your first element is a pair with string "zero" corresponding to int 0.
{ "one" , 1 },
{ "two" , 2 },
...
};
This will take every value between transformedInput.begin() to transformedInput.end(), perform the ::tolower operation on them, and write them back into transformedInput. You need to #include <algorithm> because this function is defined in <algorithm> http://www.cplusplus.com/reference/algorithm/transform/
I'm guessing transformedInput is a string, it just makes each character lower-case.
m.find() will search the map keys for something that matches transformedInput. If it is not found, it will return m.end(). Otherwise it will return a pointer (or iterator) to the matching key/value pair. http://www.cplusplus.com/reference/map/map/find/
Thank you guys you are the best. I have found all that on www.cplusplus.com site, but the thing is i don't quite understand some of the explanation. So it is more easy for me if somebody explains it with his own words.