Source of findBox.cpp


  1: //  Created by Frank M. Carrano and Tim Henry.
  2: //  Copyright (c) 2013 __Pearson Education__. All rights reserved.

  4: // Listing C3-1

  6: PlainBox<string> findBox(PlainBox<string> boxes[], int size, string target)
  7: {
  8:    int index = 0;
  9:    bool found = false;
 10:    while (!found && (index < size))
 11:    {
 12:       if (target == boxes[index].getItem())
 13:          found = true;
 14:       else
 15:          index++;
 16:    } // end while
 17:    return boxes[index];
 18: } // end findBox