Functions PBV,PBR and PBP


pass by value , pass by reference and pass by pointer Lecture Video
cd ~/assignments/cmps2020/lab/lab03 copy over the files provided for you cp -r /home/fac/msarr/public_files/cmps2020/lab/lab03/* /home/stu/YOURUSERNAME/assignments/cmps2020/lab/lab03/ or navigate to inside your lab03 directory ( note the . instead of the destination folder, it means "this directory") cp -r /home/fac/msarr/public_files/cmps2020/lab/lab03/* . run the example this is a main that systematically calls each of the functions that are part of this assignemnt. It call each function several times with different parameter values. It then test that the function correctly accomplished the task it was to do. Put your functions prototypes (declarations) in "functions.h" and the function bodies in "functions.cpp" a Makefile, main1.cpp, functions.h and functions.cpp have been provided for you in "main1.cpp" you will test call all your functions to make sure they work properly is is 100% your responsibility to make sure that the 4 functions you write work properly All you code should be 100% your own work, there is no reason at all why your main.cpp should look like any other, the job of the main is NOT to try to look like the example test all of your functions with different values to make sure they work and to give you experience calling them do not prompt user to enter values to test your functions, that is a good way to test them initially, however I want it do display "Pass" or "Fail" for each test of each function... you can have multiple output statements per function THERE is an example of testing a function in the examples section at examples named sample_main_to_test_a_function.cpp write the bodies for the function prototypes in your functions.cpp File: functions.h

#pragma once

#include "cmpslib19.h" // all the special functions provided for this class
#include "easylogging++.h"




// PUT THE COMPLETE FUNCTIONS in functions.cpp
// ONLY the functions headers (prototype) here


//DO NOT use the same function name for multiple functions
//when you test your functions it must be clear which function you are testing
//overloading a function name will be ambiguous so for this assignment DO NOT do it
//DO NOT return anything other than void unless it is absolutely necessary
//DO NOT use pass by refference or pass by pointer for ANY parameters that do not need to change 
//unless you make them const
//the 2 pass by value functions are the only one that does not return void







//Create 3 functions that will triple an int value
//each of the functions will have one parameter, the integer to triple
//one function will be PBV, one function will be PBP and one function will be PBR 
//PBV returns int  , others return void


int  TripleInt1 ( const int );
void TripleInt2 ( int * );
void TripleInt3 ( int & );



//create two functions that will allow a user to swap two integer values 
//one function will have two PBR parameters and 
//one function will have two PBP parameters
//both functions return void
void SwapInt1 (int *,int *);
void SwapInt2 (int &,int &);



//create 3 functions that can be used to determine the larger of 2 integer values
//one function will be PBV and return the result
//the other two functions will have 3 parameters, the result ( the larger of parameter one and two ) will be stored in the third
//parameter, in one function the third parameter will be PBR and on the other PBP 
//PBV returns int  , others return void
int  Larger1( int, int );
void Larger2( int, int,int * );
void Larger3( int, int,int & );




make sure your code compiles, you can test with the following make clean make ./runme to ensure you get a good grade --------------------------------- 1. make sure you code works 2. make sure your functions match the specifications above 3. run the example and make yours match, you can do more testing, but NOT less 4. make sure your code compiles without warnings 5. make sure that non of your tests call the function with the same values and order, each test should use different values 6. log the start and end (at the very least) of all your functions 7. Test each of your functions by calling each one at least 4 times with disparate values