Red de conocimientos turísticos - Conocimientos sobre calendario chino - Elemento _ Obtener código fuente
Elemento _ Obtener código fuente
Las funciones sobrecargadas se refieren a funciones con diferentes tipos de parámetros o números pero el mismo nombre de función.
//Sobrecarga de int array
int maxOfArray(int ca[], int num)
{
int nmax = 0;
for(int I = 1; iltnumi)
{
if(ca[I] gt;ca[nmax])
nmax = I;
}
Return ca[nmax];
}
//Se debe agregar el siguiente encabezado Archivo #incluye "cadena.h".
string maxOfArray(string ca[], int num)
{
int nmax = 0;
for(int I = 1; i ltnumi )
{
if(strcmp(ca[I] gt; ca[nmax]) gt; 0)
nmax = I;
}
Devolver ca[nmax];
}