Hello,
I have a map that contains the alphabet (key) and a double (value) and I would like to sort the list so that the highest value is at the top but it still keeps it's key..
E.g.
#include <iostream>
#include <map>
int main()
{
map<char, double> alphabet;
alphabet['a'] = 10.2;
alphabet['b'] = 20;
alphabet['c'] = 10;
return 0;
}
list would be:
B = 20;
A = 10.2
C = 10
Any ideas?
Also, is there a way that will allow the values to be set like a Dictionary in C# e.g.
public map<char, double> alphabet()
{
// set the values
};
Any help would be amazing, thanks :)