文章目录
##例7.1
int main()
{ void print_star();
void print_message();
print_star();
print_message();
print_star();
return 0;
}
void print_star()
{ printf("******************\n"); }
void print_message()
{ printf(" How do you do!\n"); }
##例7.2
int main()
{ int max(int x,int y);
int a,b,c;
printf("please enter two integer numbers: ");
scanf("%d,%d",&a,&b);
c=max(a,b);
printf("max is %d\n",c);
return 0;
}
int max(int x,int y)
{
int z;
z=x>y?x:y;
return(z);
}
##例7.3
int main()
{
int max(float x,float y);
float a,b;
int c;
scanf("%f,%f",&a,&b);
c=max(a,b);
printf("max is %d\n",c);
return 0;
}
int max(float x,float y)
{ float z;
z=x>y?x:y;
return (z);
}
##例7.4
int main()
{
float add(float x,float y);
float a,b,c;
printf("Please enter a and b:");
scanf("%f,%f",&a,&b);
c=add(a,b);
printf("sum is %f\n",c);
return 0;
}
float add(float x,float y)
{float z;
z=x+y;
return (z);
}