Computer Science Homework Solutions
Problem
#176160

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

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
list::iterator maxLoc(list& aList);

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

string strArr[] = ("insert", "erase", "template", "list");
int strSize = sizeof(strArr)/sizeof(string);
list 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.

Attached file(s):
Attachments
Assignment6.cpp  View File
Solution
What is this?
By OTA - Overall OTA Rating
Purchase Cost Now
$2.19 CAD (was ~$11.97)
Included in Download
  • Plain text response
  • Attached file(s):
    • iter.cpp
    • iter.zip
$2.19 Instant Download
Add to Cart
Why you can trust BrainMass.com
  • Your Information is Secure
  • Best Online Academic Help Service
  • Students find real academic Success
Related Solutions
  • Data Structures with C++ (STL) - Consider the class declaration class demoClass { public: // assign arguments as initial values for the data members demoClass(int a = 5, int b = 10); // function ...
  • MVC Design Pattern alternatives - There are other design patterns that may be directly applicable to PHP programming, or web programming in general. Find another design pattern which could be used for web based development and write a ...
  • Declarations in C - ****This is "C" Programming**** I selected "b" but I've always seem to get lost doing Boolean. Assuming the following declarations: int A=1, B=2, C=3, D=4; What is the value of the fol ...
  • VB - Application Development - Hints: 1. How would you use Integers and Strings in an application? Start off by defining integers and strings. Include examples. 2. Are Integers and Strings considered objects in VB? Elaborate. ...
  • Examples of correct Variable declaration in C++ - Which of the following variable declarations are correct? If a variable declaration is not correct give the reason(s) and provide the correct variable declaration. n = 12; //Line 1 ...
Browse