Functions Pass By Reference, Pass By Value


Video Overview
For this assignment you will create and test PBV and PBR functions Copy over all the files provided for you from /home/fac/msarr/public_files/cmps2020/hw/hw01 cp -r /home/fac/msarr/public_files/cmps2020/hw/hw01/* /home/stu/YOURUSERNAME/assignments/cmps2020/hw/hw01/ or navigate into your hw01 directory ( note the . instead of the destination folder, it means "this directory") cp -r /home/fac/msarr/public_files/cmps2020/hw/hw01/* . 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 functions above the main in your main.cpp they go in functions.h to test you need to call each function at least the number of times in the comments 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"


// create a function  that RETURNS the middle (not average) value of 3 integer parameters
int	Function1PBV( int a,int b,int c)
{
// log the start of the function		
// if (a <= b  && a >= c) then a is the middle
// if (a >= b  && a <= c) then a is the middle
// use similar test to see if b is the middle value
// if a or b are not the middle it must be c
// log the end of the function and the value you are returning

}

// 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 the start of the function
// determine the middle value and store it into result
// log the end of the function

}

// 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 the start of the function 
// calculate the sum of the sum of all the parameters
// log the end of the function and the value that you will be returning
// return the sum
}


// 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 the start of the function 
// calculate the sum of the sum of parameters 2 through 6
// log the end of the function 
}


// create a function 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 the start of the function
// sort the values
// log the end of the function

// if one > two swap them
// if two > three swap them
// if one > two swap them
// after those 3 operations it should be sorted
}

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 << boolalpha << 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 and the parameters (this is done aready but LOOK AT HOW IT IS DONE 5. make sure your code compiles WITHOUT warnings