//Author: Justin C. Miller 
// a first look at functions

// IT IS BEST TO SPLIT ANY PROGRAM UP
// into as many small little chunks as possible
// long confusing code is not good

// function are the easiest way to split things up
// below is two programs, the second one is the better
// of the two...

// PROGRAM1
int main()
{
	int a = 5 ;
	int b = 10 ;
	
	cout << a << endl ;
	cout << b << endl ;
	cout << (a + b) << endl ;
	cout << (a - b) << endl ;
	cout << (a * b) << endl ;
	cout << (a / b) << endl ;

	char x = 'x' ;
	char y = 'y' ;

	cout << x << endl ;
	cout << y << endl ;
	cout << "x" << x << endl ;
	cout << "y" << y << endl ;
	for(int i = 0 ; i < 10 ; i++)
	{
		cout << x ;
		cout << y ;
	}

	return 0 ;
}


// PROGRAM 2
// in this program the above has been split
// into easy to understand functions
// thus shortening the main function 
// cleaning it up and making it look better
// and easier to read

// the following 2 lines of code are FUNCTION PROTOTYPES
// they are simply skeletons of the real function
// the compiler needs them hear so that it know that
// you'll define the function later in the program
// and in fact we define these 2 functions right
// after the main function
void myINTEGERS(int, int) ;
void myCHARACTERS(char, char) ;

int main()
{
	int a = 5, b = 10 ;
	myINTEGERS(a, b) ;

	char x = 'x', y = 'y' ;
	myCHARACTER(x, y) ;
	
	return 0 ;
}

// the function definition of myINTEGERS
void myINTEGERS(int a, int b) 
{
	
	cout << a << endl ;
	cout << b << endl ;
	cout << (a + b) << endl ;
	cout << (a - b) << endl ;
	cout << (a * b) << endl ;
	cout << (a / b) << endl ;
}

void myCHARACTERS(char x, char y) 
{
	cout << x << endl ;
	cout << y << endl ;
	cout << "x" << x << endl ;
	cout << "y" << y << endl ;
	for(int i = 0 ; i < 10 ; i++)
	{
		cout << x ;
		cout << y ;
	}
}
