1: // Created by Frank M. Carrano and Timothy M. Henry.
2: // Copyright (c) 2017 Pearson Education, Hoboken, New Jersey.
3: // Listing C3-1
5: PlainBox<std::string> findBox(PlainBox<std::string> boxes[], int size,
6: std::string target)
7: {
8: int index = 0;
9: bool found = false;
10: while (!found && (index < size))
11: {
12: found = (target == boxes[index].getItem());
13: if (!found)
14: index++; // Look at next entry
15: } // end while
16:
17: return boxes[index];
18: } // end findBox