Question:
Write the definition of a function minMax that has five parameters. The first three parameters are integers. The last two are set by the function to the largest and smallest of the values of the first three parameters.
The function does not return a value.
The function can be used as follows:
******int a=31, b=5, c=19, big, small;
******minMax(a, b,c,&big,&small );
************/* big is now 31 */
************/* small is now 5 */
My Answer:
void minMax(int a,int b, int c, int *big, int *small){
if(a>b && a>c){
a= *big;
}
if(b>a && b>c){
b= *big;
}
else if(c>a && c>b){
c= *big;
}
else if(a<b && a<c){
a= *small;
}
else if(b<a && b<c){
b= *small;
}
else{
c= *small;
}
}
Errors:
Remarks:
*****⇒*****Your function did not change the values of class=code>big or
Don't have to give answers I'm fine with suggestions as how to solve this plz help!
Write the definition of a function minMax that has five parameters. The first three parameters are integers. The last two are set by the function to the largest and smallest of the values of the first three parameters.
The function does not return a value.
The function can be used as follows:
******int a=31, b=5, c=19, big, small;
******minMax(a, b,c,&big,&small );
************/* big is now 31 */
************/* small is now 5 */
My Answer:
void minMax(int a,int b, int c, int *big, int *small){
if(a>b && a>c){
a= *big;
}
if(b>a && b>c){
b= *big;
}
else if(c>a && c>b){
c= *big;
}
else if(a<b && a<c){
a= *small;
}
else if(b<a && b<c){
b= *small;
}
else{
c= *small;
}
}
Errors:
Remarks:
*****⇒*****Your function did not change the values of class=code>big or
Don't have to give answers I'm fine with suggestions as how to solve this plz help!
Comment