#include #include #include #include using namespace std; /* ADD CLASS ACTOR HERE */ // Everything below this line is given. Mustn't be modified void sort_descending(std::vector & actors) { // Simple selection sort. For each element current in range [0,size) for ( unsigned current {}; current < actors.size(); ++current ) { // find largest value in range [current,size) unsigned max_index {current}; for ( unsigned idx {current+1}; idx < actors.size(); ++idx ) { if ( actors[max_index] < actors[idx] ) { max_index = idx; } } // swap current with smallest std::swap(actors[current], actors[max_index]); } } void print_best_actors(std::vector const & a, unsigned const N=3) { cout << "Best " << N << " actors:\n"; for (unsigned idx{}; idx < N; ++idx ) { if ( idx+1 actors; actors.push_back(Actor{"McGuffinton", 2.3}); actors.push_back(Actor{"Zoe Madeupinton", 6}); actors.push_back(Actor{"Outaideasstein", 10}); sort_descending(actors); print_best_actors(actors); }