0
Folks someone can help me.
I have to do the following function below.
Elaborate a function to return the highest value between two numbers, using template.
The function should contain no more than two formal parameters.
Actual (current) parameter values do not may be amended
#include<stdio.h>
#include<iostream>
using namespace std;
template<class T>
void maior(T *Param1 , T *Param2){
T aux;
if(Param1 >= Param2)
aux = *Param1;
else
aux = *Param2;
};
int main()
{
int aux;
int num1 = 3 , num2 = 4;
maior <int>(&num1 , &num2);
cout<<"O maior valor é:"<< aux <<endl;
I don’t know if it’s this way.
You didn’t put back in
maior
, as the comparison is also wrong– Jefferson Quesado
can explain me better I’m studying on my own, I don’t understand much.
– Carlos Ferreira
Related: https://answall.com/q/57790/64969
– Jefferson Quesado
I searched here on the website for template C++ and came a lot of useful and cool stuff, maybe some of the answers will solve your problem
– Jefferson Quesado