I am using C++ and i have 2 vectors that a related to each other:
vector<double> val = {.3,.5,.2,.4};
vector<string> str = {'a','b','c','d'};
I would like to search val for the max, and then return the string from str in the same position:
vector<double>::const_iterator it;
it = max_element(val.begin(), val.end());
So, how can i use it
inside str
to get the letter?
string lettter;
letter = str.at(it-> ????? );
Thank!!!