This project is the same as Programming Project 13.12 except that in this project your program will use a more sophisticated method for choosing the answer to a question. When your program reads a question, it counts the number of characters in the question and stores the number in a variable named count. It then responds with answer number count%ANSWERS . The first answer in the file is answer number 0, the next is answer number 1, then 2, and so forth. ANSWERS is defined in a constant declaration, as shown next, so that it is equal to the number of answers in the answer file:
const int ANSWERS = 8;
This way you can change the answer file so that it contains more or fewer answers and you need to change only the constant declaration to make your program work correctly for a different number of possible answers. Assume that the answer listed first in the file will always be the following, even if the answer file is changed:
I'm not sure but I think you will find the answer in Chapter #N.
When replacing the two characters #N with a number, use the number (count NUMBER_OF_CHAPTERS + 1), where count is the variable discussed previously, and NUMBER_OF_CHAPTERS is a global named constant defined to be equal to the number of chapters in this book.
Sorry the answer is not available at the moment…
If you are able to find the answer, please make sure to post it here. So that your Juniors have smile on their lips and feel happy.
Spread the 'tradition of sharing'.