// Wyo C++										Name -
// Ch. 9 Worksheet #2

#include <iostream.h>
#include "M:\C++ Programming\AP classes\apstring.h"

void displayMessage(apstring);				// displays welcome message
void displayInt(int, bool);				// displays an int with or without style
void makeItLarge(int remainsSmall);			// tries to make its parameter large
void makeItLargePassByReference(int & wasSmall);	// makes its parameter large

int main()
{
	int localYokel = 12;					

	displayMessage("Hello");

	makeItLarge(localYokel);

	displayInt(localYokel, 1);

	makeItLargePassByReference(localYokel);

	displayInt(localYokel, 0);
	
	displayMessage("Goodbye");

	return 0;
}// end of main

void displayMessage(apstring message)
{	
		cout << message << endl;
}// end of displayMessage

void displayInt(int anInteger, bool styleFlag)
{
	// displays with fancy style if styleFlag is true, plain otherwise

	if (styleFlag)
	{
		cout << "***** " << anInteger << " *****" << endl;
	}
	else
	{
		cout << anInteger << endl;
	}

}// end of displayInt

void makeItLarge(int remainsSmall)
{
	int localYokel = 1000000;

	remainsSmall += localYokel;
}// end of makeItLarge

void makeItLargePassByReference(int & wasSmall)
{
	int localYokel = 2000000;

	wasSmall += localYokel;
}// end of makeItLargePassByReference


// Answer the following lined paper.

// 1. Describe the output produced by the program above by writing its output on lined paper.

// 2. How many functions are found in the program above?

// 3. How many function prototypes are listed?

// 4. Give the name of the first actual parameter cited in the source code.

// 5. Give the name of the first formal parameter cited in the source code.

// 6. Write out the first function header in the source code.

// 7. Write out the body of the displayMessage function.

// 8. How many functions are called by the main function?

// 9. Explain how the identifier localYokel is used in this program. Be sure to identify
//		the scope of the variable(s) localYokel.

// 10. Describe exactly how passing by value and passing by reference are used in 
//		this program. Use terms like calling function, called function, actual parameter,
//		formal parameter, value, ampersand, etc.


// 11. Fully describe how the program displays good organization, autonomy, encapsulation,
//		and reusability in a four paragraph essay.