CS12
Lab 7
Lab Tasks
In this lab you will be using templates to write a few generic functions. These functions should
work for any of the predefined C++ numerical types (short, int, double, float, etc). You should implement the following
functions:
- max(param1, param2) - Returns the maximum of the two parameters
- add(param1, parma2) - Returns the sum of the two paramters
- percentage(param1, param2) - Returns the percentage of param1/param2. That is
you should return (param1/param2)*100. Think about the return type. What should the return type
be? Will it change with different parameter types?
- power(param1 param2) - returns param1^param2. That is param1 raised to the param2th power. Use a for loop
to make this easy.
Make a main that tests all these functions.