/*
 * Name: Jane-Joe Student
 * Login: cs5aXX
 * Date: Month Day, Year
 * File: max_min.c
 * Sources of Help: ...
 *
 * A program to determine and display the largest and smallest of two
 * values entered by the user.
 * Demonstrates several aspects of functions including:
 *    - function prototypes
 *    - function calls
 *    - actual arguments
 *    - formal parameters
 *    - local variables
 *    - return values
 */

/*
 * Standard C Library Header Files.
 */

#include 

/*
 * Function prototypes for the functions we wrote for this program.
 */

int maximum( int num1, int num2 );  /* Returns the larger of two integers. */
int minimum( int num1, int num2 );  /* Returns the smaller of two integers. */

/*
 * Name:       main
 * Purpose:    Main driver for program to determine the largest and
 *             smallest of two integers entered by the user.
 * Parameters: None.
 * Return:     0 for successful completion of program.
 */

int
main( void )
{
    int input1, input2;
    int maxInput, minInput;

    /*
     * Prompt and read in two integers from user.
     */

    printf( "Enter two integers: " );
    scanf( "%d%d", &input1, &input2 );

    /*
     * Calculate which of the two integers is larger and smaller.
     */

    maxInput = maximum( input1, input2 );
    minInput = minimum( input1, input2 );

    /*
     * Special case to check if they are actually equal.
     */

    if ( maxInput == minInput )
    {
	printf( "%d is equal to %d\n", maxInput, minInput );
	return 0;
    }

    /*
     * Display which is larger and which is smaller.
     */

    printf( "%d is larger than %d\n", maxInput, minInput ); 
    printf( "%d is smaller than %d\n", minInput, maxInput ); 

    return 0;
}

/*
 * Name:       maximum
 * Purpose:    Determines which of two integers is the largest.
 * Parameters: int firstNumber -- the first integer to compare
 *             int secondNumber -- the second integer to compare
 * Return:     The largest of the two parameters.
 *             If they are equal, return the second parameter.
 */

int
maximum( int firstNumber, int secondNumber )
{
    int max;

    /*
     * Determine which is the larger parameter and return that value.
     */

    if ( firstNumber > secondNumber )
	max = firstNumber;
    else
	max = secondNumber;

    return max;
}

/*
 * Name:       minimum
 * Purpose:    Determines which of two integers is the smallest.
 * Parameters: int firstNumber -- the first integer to compare
 *             int secondNumber -- the second integer to compare
 * Return:     The smallest of the two parameters.
 *             If they are equal, return the second parameter.
 */

int
minimum( int firstNumber, int secondNumber )
{
    int min;

    /*
     * Determine which is the smaller parameter and return that value.
     */

    if ( firstNumber < secondNumber )
	min = firstNumber;
    else
	min = secondNumber;

    return min;
}