Purchase Solution

Iterators

Not what you're looking for?

Ask Custom Question

See the attached file.
Implement the function maxLoc(), which returns an iterator pointing at the largest element in a list.

//return an iterator pointing to the largest element
//in the list.

template <typename T>
list<T>::iterator maxLoc(list<T>& aList);

Write a program that tests maxLoc(), using the following declarations:

string strArr[] = ("insert", "erase", "template", "list");
int strSize = sizeof(strArr)/sizeof(string);
list<string> strList(strArr, strArr+StrSize)

The program should repeatedly call maxLoc(), output the largest value, and then delete the value, until the list is empty.

I am attaching a .cpp file of the program. It is mostly complete but when I compile I don't seem to get the right result.

Attachments
Purchase this Solution

Solution Summary

The solution implements the function maxLoc(), which returns an interator pointing at the largest element in a list.

Purchase this Solution


Free BrainMass Quizzes
Word 2010: Table of Contents

Ever wondered where a Table of Contents in a Word document comes from? Maybe you need a refresher on the topic? This quiz will remind you of the keywords and options used when working with a T.O.C. in Word 2010.

C# variables and classes

This quiz contains questions about C# classes and variables.

Basic UNIX commands

Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.

Basic Computer Terms

We use many basic terms like bit, pixel in our usual conversations about computers. Are we aware of what these mean? This little quiz is an attempt towards discovering that.

Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.