Keyword Responses

  1. For this component, add a new class called keyword. It is very similar to random. The main difference is that here, you need to have two arrays, one for the responses, and one for keywords. For example, suppose that the first keyword is "love". If it appears in the user's input, you will output a pre-stored phrase that is somewhat related to the keyword. One such phrase might be: "Everybody loves somebody sometime."
  2. This class also has a member function called reply In reply, you want to check whether your keywords appear in the user's response. You want to stop once you determined that a keyword appears in the user's response. In that case, you print the associated response to the screen and your function should return "true". Recall a string member function that we have seen in class. Suppose you have a string variable foo.
  3. Test your keyword component by declaring a keyword object in your main function and call the function reply with a string that you make up. Call it with a string that contains a keyword from your database, as well as with a string that does not contain a keyword.