Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is a c++ program STL Activity #2 . Using only the STL, Write a function BiasedSort that accepts a vector by reference and sorts

image text in transcribed

This is a c++ program

STL Activity #2 . Using only the STL, Write a function BiasedSort that accepts a vector by reference and sorts the vector lexicographically (fancy way of saying alphabetically or normally), except that if the vector starts with the string Me First," that string is always at the front of the sorted list. o This may seem like a silly problem, but can come up in some circumstances. o For example, if you have a list of songs in a music library, you might want songs with the title "Untitled" to always appear at the top. So write a custom sort method that compares two strings: (Write a custom myList; myList.push_back("Song 1"); myList.push_back("Song 5"); myList.push_back("A Song 2"); myList.push_back("Song 2"); myList.push_back("Song 3"); myList.push_back("Me First Song 3"); myList.push_back("Song 7"); myList.push_back("Song 8"); myList.push_back("Me First Song 2"); myList.push_back("Song 4"); myList.push_back("Song 6"); myList.push_back("A Song 1"); myList.push_back("Me First Song 1"); // Print out the vector before the sort cout

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

Modern Database Management

Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi

13th Edition Global Edition

1292263350, 978-1292263359

More Books

Students also viewed these Databases questions