Course Solutions Uncategorized (Solved) : Need Modify Participanth Suppose Wish Able Sort Participant Objects Alphabetically Name Ev Q28285935 . . . .

(Solved) : Need Modify Participanth Suppose Wish Able Sort Participant Objects Alphabetically Name Ev Q28285935 . . . .

 

I need to modify Participant.h

Suppose we wish to be able to sort Participant objectsalphabetically by name even when scores and ages are not tied. Iffact we want to be able to specify which attribute to sort by,name, age, or score. We will do this by declaring three separatecomparison functions in the .cpp file. We will then add to theParticipant class a static pointer to a function. This pointershould be called comp_cb and it should point to one of thecomparison functions defined.

//sortingByAttribute.cpp

#include “Data.h”
#include “Sortable.h”
#include “Participant.h”

using namespace std;

bool sortByName(const Participant * p1, const Participant *p2){
return p1->name > p2->name;
}

bool sortByAge(const Participant * p1,

OR

PayPal Gateway not configured

OR

PayPal Gateway not configured

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post