Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

having trouble with the next part of my code, I have included here what is in my public header, my private and my main. I

having trouble with the next part of my code, I have included here what is in my public header, my private and my main. I created my method and partly defined my method, but based on what I am supposed to do I know I don't have everything. I think I am supposed to have a for statement after it? What I am doing here is creating a sort by attribute method.


//The method should have a SortBy parameter passed to it. Call the MergeSort method. Pass to it the _heroes vector of the class and the SortBy parameter.

//Print the items in the sorted vector that is returned from MergeSort.

//NOTE 1: print the hero ID, selected attribute, and name (see screenshot).

//To get the selected attribute, call the non-static GetSortByAttribute method on each hero. Here's an example of calling the GetSortByAttribute method: std::string attribute = hero.GetSortByAttribute(sortByChoice);

//NOTE 2: The SortBy value is collected already in main. Pass it to your SortByAttribute when calling it.

//NAME RETURNS PARAMETERS SortByAttribute nothing SortBy COMMENTS Calls the MergeSort method passing the _heroes vector and SortBy parameter.

//Print the items in the vector that is returned from MergeSort. In main (which is in HeroesV2.cpp), add code to case 2 of the switch. Call your SortByAttribute method and pass the sortByChoice variable to it.//

imageimageimage

After creating the SortByAttribute method in HeroesDB (part A-2), add code to case 2 of the switch. Call the SortByAttribute method and pass the sortByChoice variable to it. int sortBySelection = Input::GetMenuSelection(sortByOptions); Sort By sortByChoice = (Sort By) sortBySelection; break;

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Foundations of Financial Management

Authors: Stanley Block, Geoffrey Hirt, Bartley Danielsen, Doug Short, Michael Perretta

10th Canadian edition

1259261018, 1259261015, 978-1259024979

More Books

Students also viewed these Algorithms questions

Question

Explain in detail the role of data analytics in healthcare.

Answered: 1 week ago