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. #include #include #include #include #include #include using std::cin; using std::cout; using std::endl;

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

 #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

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

4th Edition

0805360476, 978-0805360479

More Books

Students also viewed these Databases questions

Question

a. Describe the encounter. What made it intercultural?

Answered: 1 week ago