Functions Pass By Reference, Pass By Value, Pass By Pointer

For this assignment you will create and test PBR ,PBV and PBP functions

Copy over all the files provided for you from 
/home/fac/msarr/public_files/cmps2020/hw/hw02 

(you may want to copy some of your homework1 as this one just expands on it)


first comment out the function bodies you have not completed
then complete one function,
in the main test it then move onto the next one
repeat this process

save your self a lot of trouble and dont try to write all you stuff and then start to compile
you should rarely if ever edit more than 4 lines of code in between attempts to compile... if   you get errors fix them before proceeding.

if you need to comment out sections of your code to test it in your main do that.. one thing at a time so you dont get overwhelmed by a ton of compitation errors

dont put your funcitons obove the main in your main.cpp
they go in funtions.h

to test you need to call each function at least 4 times passing it different values in different order, try to pass in values that might break it.. your job here is to ensure that it works properly all the time

you will complete and test the functions defined in 

File: functions.h

#include "easylogging++.h"
#include "cmpslib19.h"

// put your function bodies here


// create a function  that RETURNS the middle (not average) value of 3 integer parameters
int	Function1PBV( int a,int b,int c)
{
  LOG(INFO) << "Start " <<  __PRETTY_FUNCTION__ << endl;
  LOG(INFO) << "Start Params: " << a <<","<< b <<"."<< c << endl;
  // if (a < b  && a > c) then a is the middle
  // and so forth

  LOG(INFO) << "End " <<  __PRETTY_FUNCTION__ << endl;
  LOG(INFO) << "returning:" << result << endl;
	return result;
}

// create a function  that determines the middle value of ( int )parameters 2,3 & 4
// STORE THAT VALUE into the 1st parameter
void Function1PBR(int &result, int a,int b,int c)
{
  LOG(INFO) << "Start " <<  __PRETTY_FUNCTION__ << endl;
  LOG(INFO) << "Start Params: " << result << "," << a << "," << b << "." << c << endl;
  LOG(INFO) << "End " <<  __PRETTY_FUNCTION__ << endl;
  LOG(INFO) << "End Params: " << result << "," << a << "," << b << "." << c << endl;

}

// create a function  that determines the middle value of ( int )parameters 2,3 & 4
// STORE THAT VALUE into the 1st parameter
void Function1PBP(int *result, int a,int b,int c)
{
  LOG(INFO) << "Start " <<  __PRETTY_FUNCTION__ << endl;
  LOG(INFO) << "Start Params: " << result << "," << a << "," << b << "." << c << endl;
  LOG(INFO) << "End " <<  __PRETTY_FUNCTION__ << endl;
  LOG(INFO) << "End Params: " << result << "," << a << "," << b << "." << c << endl;

}



// create a function that returns the sum of parameters 1,2,3,4 & 5 
double Function2PBV(double a,double b,double c,double d,double e)
{
  LOG(INFO) << "Start " <<  __PRETTY_FUNCTION__ << endl;
  LOG(INFO) << "Start Params: " << a << "," << b << "." << c << "," << d << "," << e << endl; 
  LOG(INFO) << "End " <<  __PRETTY_FUNCTION__ << endl;
  LOG(INFO) << "Returning: " << result << endl; 
	return result;
}

// create a function that determines the sum of parameters 2,3,4,5 & 6
// STORE THAT VALUE into the 1st parameter
void	Function2PBR(double& result ,double a,double b,double c,double d,double e)
{
  LOG(INFO) << "Start " <<  __PRETTY_FUNCTION__ << endl;
  LOG(INFO) << "Start Params: " << result << "," << a << "," << b << "." << c << "," << d << "," << e << endl; 
  LOG(INFO) << "End " <<  __PRETTY_FUNCTION__ << endl;
  LOG(INFO) << "End Params: " << result << "," << a << "," << b << "." << c << "," << d << "," << e << endl; 

}

// create a function that determines the sum of parameters 2,3,4,5 & 6
// STORE THAT VALUE into the 1st parameter
void	Function2PBP(double* result ,double a,double b,double c,double d,double e)
{
  LOG(INFO) << "Start " <<  __PRETTY_FUNCTION__ << endl;
  LOG(INFO) << "Start Params: " << result << "," << a << "," << b << "." << c << "," << d << "," << e << endl; 
  LOG(INFO) << "End " <<  __PRETTY_FUNCTION__ << endl;
  LOG(INFO) << "End Params: " << result << "," << a << "," << b << "." << c << "," << d << "," << e << endl; 

}







// create a functions that can sort parameters 1 ,2 ,3  in ascending order
// use pass by refernce only for parameters that need to change
// regardles of the values in the parameter before calling
// after calling the 1st parameter will contain the lowest value
// after calling the 2nd parameter will contain the middle value
// after calling the 3rd parameter will contain the highest value

void Function3PBR(double& one , double& two, double& three)
{
  LOG(INFO) << "Start " <<  __PRETTY_FUNCTION__ << endl;
  LOG(INFO) << "Start Params: " <<  one << "," << two  << "." << three << endl; 
  // to sort
  // if one < two swap them
  // if two < three swap them
  // if one < two swap them
  // after those 3 operations it should be sorted


  LOG(INFO) << "End " <<  __PRETTY_FUNCTION__ << endl;
  LOG(INFO) << "End Params: " <<  one << "," << two  << "." << three << endl; 
}


// create a functions that can sort parameters 1 ,2 ,3  in decending order
// use pass by pointer only for variables that need to change
// regardles of the values in the parameter before calling
// after calling the 1st parameter will contain the highest value
// after calling the 2nd parameter will contain the middle value
// after calling the 3rd parameter will contain the lowest value
void Function3PBP(double* one, double* two, double* three)
{
  LOG(INFO) << "Start " <<  __PRETTY_FUNCTION__ << endl;
  LOG(INFO) << "Start Params: " <<  one << "," << two  << "." << three << endl; 
  LOG(INFO) << "End " <<  __PRETTY_FUNCTION__ << endl;
  LOG(INFO) << "End Params: " <<  one << "," << two  << "." << three << endl; 
}






functions.h -- put your functions here, prototypes and bodies main1.cpp -- create a main to test that your functions do what they are supposed to do the one of the functions is done for you as well as the code to test it when you compare the results of type double you will want to use the VeryClose function in the library the link to the library documentation is on the main page here is an example comparing dResult with 219.3 std::cout << PF(VeryClose( dResult,219.3)) << endl; for full credit: 1. In the main you will need to test ALL of your functions and make sure they are correct 2. Test each of your functions by calling each one at least 3 times with disparate values 3. log the start and end of all functions at the VERY LEAST 4. Give each function a distinct name (no overloading) so that it is clear that you are testing every function 5. make sure your code compiles without warnings
FLOWCHART: sort 3 values pass by referennce

FLOWCHART: sort 3 values pass by referennce