Searching for an Item by a Substring

Let's add some capabilities to our home inventory project. First on the list is the ability to find an item by searching for a sequence of chars in its description. Before we see how this is implemented, let's take a look at how it is used. Figure 12.22 shows the new application program that uses this feature.

Figure 12.22. The latest home inventory application program (code\hmtst6.cpp)
 #include <iostream> #include <fstream> #include <string> #include "Vec.h" #include "xstring.h" #include "hmit6.h" #include "hmin6.h" using namespace std; int main() { ifstream HomeInfo("home3.in"); HomeInventory MyInventory; HomeItem TempItem; xstring Name; xstring Description; MyInventory.LoadInventory(HomeInfo); TempItem ...

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.