请教一下函数重载问题,这个程序为什么编译不通过,谢谢!
#include "stdafx.h"int max (int a,int b)
{
return 111;
}
int max (int a,int b,int c)
{
return 222;
}
int max (int array[],int len)
{
int imax = 0;
for (int i = 0;i < len;i++)
{
if (array[i] > imax)
{
imax = array [i];
}
}
return imax;
}
float max (float array[],int len)
{
float imax = 0;
for (int i = 0;i < len;i++)
{
if (array[i] > imax)
{
imax = array [i];
}
}
return imax;
}
double max (double array[],int len)
{
double imax = 0;
for (int = 0;i)
{
if (array [i] > imax)
{
imax = array [i]''
}
}
return imax;
}
int _tmain(int argc, _TCHAR* argv[])
{
int a[6] = {1,2,3,4,5,6};
float af[6] = {1.0,3.0,1.0,0,0,99.8877};
printf ("%d,%d\n",max (1,2),max (1,1,1));
printf ("数组a最大值为%d\n",max (a,sizeof(a)/sizeof(int));
printf ("数组a最大值为%f\n",max (af,sizeof (af)/sizeof(float));
return 0;
}