#include
#include
#include
#include
#include
#include
using namespace std;
typedef pair Pair;
inline bool less_than_second( const Pair& b1, const Pair& b2 ){
return b1.second < b2.second;
}
int main(){
const char* names[] = { "A","B", "C", "D","E" };
const int values[] = { 18, 20, 26, 30, 41 };
const int num_pairs = sizeof( names ) / sizeof( names[0] );
vector pair( num_pairs );
transform( values, values+num_pairs, names,pair.begin(), make_pair );
sort( pair.begin(), pair.end() );
sort( pair.begin(), pair.end(), less_than_second );
vector::const_iterator pair_end = pair.end();
for( vector::const_iterator i = pair.begin();
i != pair_end; ++i )
cout << i->second << " - $" << i->first << " values\n";
}