Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Recode orange sorting example such that it uses multimaps and upper_bound(), lower_bound() functions. // sorting oranges // converting vectors to multimaps #include #include #include #include

Recode orange sorting example such that it uses multimaps and upper_bound(), lower_bound() functions.

// sorting oranges // converting vectors to multimaps #include  #include  #include  #include  #include  #include  using std::cin; using std::cout; using std::endl; using std::string; using std::vector; enum class Variety {orange, pear, apple}; vector colors = {"red", "green", "yellow"}; struct Fruit{ Variety v; string color; // red, green or orange }; int main(){ srand(time(nullptr)); vector  tree(rand()%100+1); for(auto f=tree.begin(); f!=tree.end(); ++f){ f->v = static_cast(rand() % 3); f->color = colors[rand()%3]; } cout << "Colors of the oranges: "; for(auto f=tree.begin(); f!=tree.end(); ++f) if(f->v == Variety::orange) cout << f->color << ", "; cout << endl; } 

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

101 Database Exercises Text Workbook

Authors: McGraw-Hill

2nd Edition

0028007484, 978-0028007489

More Books

Students also viewed these Databases questions

Question

Develop clear policy statements.

Answered: 1 week ago

Question

Draft a business plan.

Answered: 1 week ago

Question

Describe the guidelines for appropriate use of the direct plan.

Answered: 1 week ago