We started this chapter with our work cut out for us: The program was performing as intended, so we just had to go over exactly how it worked. We started with the new main function, which consists of two consecutive "endless" loops (loops that execute until a particular criterion is met). The first loop keeps executing as long as the user is still entering, modifying, or examining the data in the inventory. When the user is finished, the only remaining question is whether he or she wants to save the changes, so the code in the second loop is designed to find the answer to that question and either save or discard the changes as desired.

The main work of the program is done inside the first loop, which consists of a call to the GetMenuChoice ...

Get Learning to Program in C++ now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.