In that code 'index' is already declared, so let's take advantage of that fact and not declare it again. We shall see more of this versatility later. A second change we might consider making involves the repeated use of the same search code in 'Add', 'Delete' and 'ReplaceContract'. This new function would only be used by member functions, so it could be declared as private to the class. Note that this idea of private functions is not something foreign to the way the 'real world' operates.
Organizations often have procedures known only within the organization.
That is part of what makes organizations different from each other. The first step in this change is to declare our new function, call it 'Search', as private to the class. Search' should be unavailable outside the class just as the data members are unavailable so it is declared as private. In other words, 'Search' and the data members are all encapsulated. A careful look at the old code might lead you to expect that this function should return a Boolean, since all the searches set a variable 'found' to true or false.