<pre name="code" class="cpp">#include<stdio.h>
int main()
{
int max4(int a,int b,int c,int d); //对max4函数的声明
int a,b,c,d,max;
printf("please input 4 interger numbers:\n");
scanf("%d%d%d%d",&a,&b,&c,&d);
max=max4(a,b,c,d); //调用max4函数
printf("max=%d\n",max);
return 0;
}
int max4(int a,int b,int c,int d) //定义max4函数
{
int max2(int a,int b); //对max2函数的声明
int m;
m=max2(a,b); //调用max2函数
m=max2(m,c); //调用max2函数
m=max2(m,d); //调用max2函数
return m;
}
int max2(int a,int b) //定义max2函数
{
if(a>=b)
{
return a;
}
else
return b;
}