Functions PBR
some short videos on using the vi editor and copying files
Vi
file commands
Pass By Reference Lecture Video
Pass By Reference Lab Video
move to the proper directory
cd ~/assignments/cmps2020/lab/lab02
copy over the files provided for you
cp -r /home/fac/msarr/public_files/cmps2020/lab/lab02/* /home/stu/YOURUSERNAME/assignments/cmps2020/lab/lab02/
or navigate into your lab02 directory ( note the . instead of the destination folder, it means "this directory")
cp -r /home/fac/msarr/public_files/cmps2020/lab/lab02/* .
for this lab you will create some functions
start by running the example.. look at the output to the console
look at the logfile it creates.
you will emulate this behavior in terms of output to the console and logfile
LOG THE BEGINNING AND END OF EVERY FUNCTION
use the TrippleInt functions as an example of how to do this
int SmallerIntPBV( int, int)
determine the smaller of two integer values passed in as parameters 1 and 2
return the result
void SmallerIntPBR( int , int , int &)
determine the smaller of two integer values passed in as parameters 1 and 2
store the result into a parameter 3
the return type must be void
use pass by reference ONLY where needed ( the 3rd parameter )
int LargerIntPBV (int, int)
determine the larger of two integer values passed in as parameters 1 and 2
return the result
parameters that do not need to change for the function to work should be pass by value or pass by const reference
void LargerIntPBR (int, int, int &)
determine the larger of two integer values passed in as parameters 1 and 2
store the result into a parameter 3
the return type must be void
use pass by reference ONLY where needed (the 3rd parameter)
parameters that do not need to change for the function to work should be pass by value or pass by const reference
SwapInt
swap the values of two int parameters passed in by reference
the return type must be void
Just modify the existing main1.cpp provided for you , you will add in your functions and test them.
in "main.cpp" you will test call all your functions to make sure they work properly
is is 100% your responsibility to make sure that the functions you write work properly
your tests should print 'true' if the function operates properly, othewise 'false'
TEST EACH FUNCTION AT LEAST 4 TIMES
you must do a test and compare the value that was the result of the function call with the correct values
for example if you tripple the value 9 ,(result == 81) is the only correct answer
the largest of ( 1,5 and 3) is (result==5)
I have provided a Makefile, to compile type 'make'
make sure your code compiles, you can test with the following
make clean
make
./runme1
run the example and make sure your logging is similar to the example
MAKE SURE YOU TYPE EXIT TO CLOSE YOUR TERMINAL !!!!