/*
 * @topic K00100 MSVC "Hello, World!" program
 * @brief in-class demo 0 -- pausing program before exiting
*/

#include <iostream> // this gives us access to cout and cin devices

/*
Example of a multi-line comment:
This function calculates square of an integer.
It takes an integer number as a parameter and also returns an integer.
*/
int square( int param )
{
    //ik-1/23/2014// commented out:
    //int temp = param * param;
    //return temp;
    return ( param * param ); // computes and returns the result
}

int main()
{
    int dummy = square( 5 ); // demonstrates a function call
    std::cout << "Hello World!";

    //----------------------------------------------
    // 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
}