Random Responses
A convenient way to store random responses is in an array of
strings. To keep with the idea of object-oriented programming, store
the entire component that handles random responses in a class. Here
are some of the things you have to do:
- Open a new RHIT console and call it Eliza.
- Add a new class, by choosing Insert/New Class from the main
menu and call the new class: random
- In this class, make provisions to store ten random responses, and
initialize them in the default constructor. The challenge is to come
up with phrases that make sense, no matter what the
context. Professors are good at that. For example, one of every
professor's favorite replies is: That is interesting.
- Write a member function called reply that, among others
calls the random generator to output to the
screen one of the ten responses. Don't forget to include the string
and IOstream libraries.
- Once you are done, generate one and only object of type
random in main.
- In order to test your program, call the member function reply
three times.