Question: Write/complete a function CriticsPick() that accepts a map of movies and their ratings (between 0.0 and 10.0) and returns a set of the names of

  • Write/complete a function CriticsPick() that accepts a map of movies and their ratings (between 0.0 and 10.0) and returns a set of the names of the top five movies in the map.
  • If there are fewer than ten elements in the map, then the resulting set should contain every string in the map.
  • Here is the data file : Movies.txt : https://drive.google.com/open?id=1QI4ePyNZchuilHCaX1pIlHV-Vn3Ceb-c
Main Program Template: #include  #include  #include  #include  #include  #include  #include  #include  using namespace std; void doP(string x) {cout << x << endl;} set criticsPick(map); int main() { map movieList; string fname = "Movies.txt"; ifstream myfile; myfile.open(fname); if (myfile.is_open() ) { cout << "File Opened" << endl; } else { cout << "BAD : " +fname<< endl; return -99; } string nameString = ""; string scoreString = ""; while (myfile) { getline(myfile,nameString); getline(myfile,scoreString); movieList[nameString]= atof(scoreString.c_str()); } //Uncomment this out to see the map. //map::iterator it = movieList.begin(); //while(it != movieList.end()) //{ // std::cout<first<<" :: "<second< results; results = criticsPick(movieList); for_each(results.begin(),results.end(),doP); } set criticsPick(map theMap) { // TODO :: Currently does nothing. }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!