Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

i need this c++ program asap a. A function template called maximum that takes 3

ID: 3706094 • Letter: I

Question

i need this c++ program asap

a. A function template called maximum that takes 3 arguments of the same type. This function must find and return the maximum value between the 3 arguments. b. A void function called AreaPerimeter that takes 3 float parameters, calculates the area and the perimeter of a circle and returns both of them to main. The first parameter of this function represents the radius of a circle NOTE: The area of a cirde is Am R2 The perimeter of a circle is: P-2* n "R Assume ? 3.14 c. A recursive function power(base.exponent) that returns the integer value: base expgnent, for example: power12, 4)-16 Hint: The recursive relationship would be: baseexponent- base base exponent And, the base case occurs when exponent is equal to 1: baseA1 base

Explanation / Answer


Given below is the code for the question.
Please do rate the answer if it was helpful. Thank you
template <typename T>
T maximum(T a, T b, T c)
{
T max;
//find larger of first 2 args
if(a > b)
max = a;
else
max = b;
//compare the larger with 3rd arg
if(c > max)
max = c;
return max;
}


//area and perimeter are reference parameters
void AreaPerimeter(float radius, float &area, float &perimeter )
{
float PI = 3.14;
area = PI * radius * radius;
perimeter = 2 * PI * radius;
}


int power(int base, int exponent)
{
if(exponent == 0) //if exponent is zero, return 1
return 1;
else if(exponent == 1)
return base;
else
return base * power(base, exponent - 1);
}