C++: Programming Problem - Prompt Y/N

Name: _________________________________

Write a function named promptYN which takes one string parameter. It prints the string (which is a question the caller supplies) on cout, then prompts the user to enter Y or N. It then reads one character from cin. If the character is a 'Y', the function returns true, if the character is a 'N', it returns false, if the characer is neither of the above, your function should prompt the user again for a 'Y' or 'N' and read another character, continuing with this until a Y or N is entered. The prototype should be the following.

   bool promptYN(string question);

Sample Usage

For example,

    while (promptYN("Do you want to continue")) . . .
would continue executing the loop as long as the user answered Y.