Hands-on 8a

Functions

$ tar xzvf session8-start.tar.gz

Parameter passing

  • Inspect the code in pass_by_value.cxx, pass_by_reference.cxx and pass_by_pointer.cxx files, compile and run the programs.
  • Comment on the different results.

Overloading

  • Inspect the code in example_overloading.cxx file, compile and run the program.
  • Comment on the computation that is done and its results.
  • Redisplay all the previous results with 12 decimal places (see // Assignment 1 in the code),
  • Overload the exponentiation function to define a float version (use the model of the double version) (see // Assignment 2a,2b).
  • Display the result of the float version in the test function (see // Assignment 2c).
  • Display the maximum limit value of integer INT_MAX defined in the system header <climits> and explain the origin of the different results (see // Assignment 3).