The Final Version of the Home Inventory Program

Now let's get to the detailed analysis of the final version of the home inventory program. We'll start with the main() function of this program, which is shown in Figure 13.1.

Figure 13.1. The main() function of the final version of the home inventory main program (from code\hmtst8.cpp)
 int main() { ifstream HomeInfo("home.inv"); HomeInventory MyInventory; char option; string answer; MyInventory.LoadInventory(HomeInfo); for (;;) { option = GetMenuChoice(MyInventory); if (option == Exit) break; else ExecuteMenuChoice(option,MyInventory); } HomeInfo.close(); for (;;) { cout << "Save the changes you have made? (Y/N) "; cin >> answer; if ((answer == "Y") || (answer == "y")) { ofstream NewHomeInfo("home.inv"); ...

Get C++: A Dialog Programming with the C++ Standard Library now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.