Notethatf r tisincludedintherangewhereas idi at is l

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ts of the stack and the heap just before main terminates. EECS 280 Fall 2013 11/25 uniqname: _________________________ c) (3 points) One of the member functions causes a memory leak. Fix it by adding one line of code to one of the V c o class member functions. etr d) (3 points) When main() returns, there is another memory leak. Fix it by adding code below. itmi( n an){ Vco () etrv1; vps_aknwit2) .uhbc(e n(); vps_aknwit3) .uhbc(e n(); Vco () /oyvit sn oyco etruv;/cp nouuigcp tr dlt .o_ak) eeevppbc(; } EECS 280 Fall 2013 12/25 uniqname: _________________________ Problem 3: Iterators and Functors (20 points) A integer bis a multiple of aif adivides b In other words, when bis a multiple of a the . , remainder of bdivided by ais 0. For example, 8 is a multiple of 4, whereas 6 is not a multiple of 4. 0 is a multiple of everything. a) Implement the functor M l i l O . The constructor of M l i l O takes an integer a, and utpef utpef requires that a is non­zero. The overload of u t p e f o e a o ( takes an integer b MlilO prtr) , and returns true if bis a multiple of a . EECS 280 Fall 2013 13/25 uniqname: _______...
View Full Document

This test prep was uploaded on 03/10/2014 for the course EECS 280 taught by Professor Noble during the Winter '08 term at University of Michigan.

Ask a homework question - tutors are online