The assignment is worth 4 points. To complete the assignment, use Visual Studio
ID: 3554173 • Letter: T
Question
The assignment is worth 4 points. To complete the assignment, use Visual Studio 2012 or 2013.
You can discuss the assignment with others, but any work submitted must be entirely your own. Programs that do not compile will not receive credit for the assignment. Refer to the class syllabus for the policy on late assignments.
Assignment:
The purpose of this assignment is to practice functions, templates, arrays, and recursion.
Create a header file mymath.h. This header file will contain math function that will work with any data type. In this header file, create the following functions:
Explanation / Answer
Dear,
template <class T>
T Maximum(T first, T second)
{
if(first > second )
return first;
else
return second;
}
template <class T>
T Minimum(T first, T second)
{
if(first < second )
return first;
else
return second;
}
template <class T>
T absolute(T value)
{
return abs(value);
}
// Function to raise x to the power n.
template <class T>
T power(T base, T exponent)
{
if(n == 0)
return 1;
else
return base * power( base , exponent - 1 );
}
//Function Definition
template <class T>
T ArraySum(T arr[],int n)
{
if(n<0)
return 0;
else
return(arr[n]+ArraySum(arr,n-1));
}//End ArraySum
T findMinimum(T array[], const int size) :,T findMaximum(T array[], const int size) : functions cannot be implemented using recursion with these parameter list using recursion. It is possible with three parameters. If you need plz get back me.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.