Write the definitions for three functions named max. Each receives two parameters, of the same type, and returns the larger of the two values. Define one of these functions to apply to type double, another to type int and a third to type char.
.
.
Click on the title for the solution
.
.
int max(int a,int b)
{if (a>b) return a;
else return b;}
float max(float a,float b)
{if (a>b) return a;
else return b;}
char max(char a, char b)
{if (a>b) return a;
else return b;}
.
Click on the title for the solution
.
.
This is the answer:
:
int max(int a,int b)
{if (a>b) return a;
else return b;}
float max(float a,float b)
{if (a>b) return a;
else return b;}
char max(char a, char b)
{if (a>b) return a;
else return b;}
Comments
Post a Comment