CPPForSchool.com: User Defined Function Set 1: Assignment 5

5. Write a function called zero_small() that has two integer arguments being passed by reference and sets the smaller of the two numbers to 0. Write the main program to access the function. 

This assignment was not too difficult, but I did run into a minor issue in regards to declaring the references, specifically with a and b.  I was under the impression that the & would be utilized throughout all of the code.  However, I was quickly reminded that it is only within the initial declaration, not every time the variable is referenced.  Once I cleared that up, everything ran smoothly.  It appears that the sample source code is much cleaner than my approach, but I believe that my version is a bit more user friendly, in regards to presentation.










Comments

Popular posts from this blog

CPPForSchool.com: Variable, Operator & Expression Set 1: Assignment 8

CPPForSchool.com: Array - Single Dimension Set 1 Assignment 6

CPPForSchool.com: Variable, Operator & Expression Set 1: Assignment 7