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

Make a template out of the following file and test on different data types, incl

ID: 3777464 • Letter: M

Question

Make a template out of the following file and test on different data types, including int, double and string.

#include <iostream>
#include <string>
using namespace std;
//Make a template out of the prototype
int myMax(int one, int two);
int main()
{
int i_one = 3, i_two = 5;
cout << "The max of " << i_one << " and " << i_two << " is "
   << myMax(i_one, i_two) << endl;

//Test your template on float and string types  
return 0;
}
//Make a template out of this function. Don't forget the return type.
int myMax(int one, int two)
{
int bigger;
if (one < two)
{
bigger = two;
}
else
{
bigger = one;
}
return bigger;
}

Explanation / Answer

#include <iostream.h>

#include <conio.h>

template <class T>

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote