Rewrite the provided rotary Queue class or the dynamic rotary Queue class that you have developed in the recent homework assignment into a queue class template.
Test your library using a simple program that adds and remove elements from the queue. For your convenience, a ready to use interactive test program has been provided.
Write a function template that calculates a maximum of three variables of the same type that are passed by constant reference. Assume that you can compare the variables using > operator. Write a short program and test your template on int, float and string-class variables.
Write a function template that accepts a two dimensional array of something (or perhaps the array of it is the "something"), the used number of rows and columns (unsigned int), and the column number (unsigned int) that needs to be processed. Your function template should add (use operator + to do the addition) together values from all rows and the given column and return it using return statement. Write a short program and test your template on int, double and string-class arrays of various size. You can use a program similar to ones that are used in the examples that illustrate the use of arrays in function templates material (You can use the pre-initialized arrays).
Hint:
The function declaration may look like
template<typename TA, typename TD> TD function(const TA& A, unsigned rows, unsigned cols, unsigned given_column, TD initial) { ... }
You may consider to examin two examples: passing a 2D array to a function
template as T (not as T[maxr][maxc]), and adding up elements of a 1D array
passed to a function as T (not as T[]). Remember that you need to write a short
program in order to test your template.