string runAgain = "maybe";
while (runAgain != "yes" && runAgain != "Yes")
{
// your coding
while(runAgain != "yes" && runAgain != "Yes" && runAgain != "no" && runAgain != "No")
{
cout << "Would you like to search for something else? ";
cin >> runAgain;
}
if( runAgain == "yes" || runAgain == "Yes" )
{
// this section of code deletes and clears the vector
// if you were to not clear the inventory then you would just multiple copies of each one, which you don't want
for(unsigned i = 0; i < Inventory.size(); ++i)
{
delete Inventory[i];
}
Inventory.clear();
}
if( runAgain == "no" || runAgain == "No" )
{
break;
}
}
this way if you want to keep trying to search for something the person can continue searching for it, if they want it, and it would be more of the user closing out of the program instead of the program just terminating and then they would have to recompile it in order to run it.