/*
 * @topic L00110 Program prints AB and pauses
 * @brief main() invokes pause() before exiting
*/

#include <iostream>

void pause()
{
    //----------------------------------------------
    // prevent window from closing before exiting:
    //----------------------------------------------
    char ch; // ch is a variable that holds a character

    // curious \n is a "line feed" control character,
    // it moves the cursor to the next line:
    std::cout << "\nEnter X to Exit: ";

    std::cin.ignore( 1, '\n' ); // extract and discard characters
    std::cin.clear();           // this clears cin state
    std::cin.get( ch ); // this reads a character from the keyboard,
                        // and pauses the program from before exiting
}

int main()
{
    char chb = 'B';
    std::cout << 'A' << chb; // prints AB
    pause();
}