/*
 * @topic S-0210-04-01-30 std::noskipws and switch
 * @brief Yes/No handled by C++ switch
*/

#include <iostream>
#include <cstdlib>
#include <string>

#define PROMPT_YN "Do you want to enter an int? Yes or No?: y/n "

int main()
{
    //const std::string PROMPT_YN = "Do you want to enter an int? Yes or No?: y/n ";
    char ch;
    for (
        std::cout << PROMPT_YN;
        std::cin >> std::noskipws >> ch >> std::skipws;
        std::cout << PROMPT_YN
        )
    {
        std::string line_ending;
        std::getline( std::cin, line_ending ); // discard \n

        switch ( ch ) {
        case 'Y':
        case 'y':
        {
            std::cout << "You said Yes! Enter an int: ";
            int value = 0;
            std::cin >> value;
            std::getline( std::cin, line_ending ); // discard \n
            std::cout << "\t\t\t you entered: " << value << "\n";
            break;
        }

        default:
        case 'N':
        case 'n':
            std::cout << " I'll take it as a No...\n";
            break;
        }//switch

    }//while

    system("pause");
    return 0;
}