Answer:
#include <iostream>
using namespace std;
void MinMax(int x,int y,int z,int *max,int *min)
{
int big,small;
if((x>y)&&(x>z)) //to check for maximum value
big=x;
else if((y>x)&&(y>z))
big=y;
else
big=z;
if((x<y)&&(x<z)) //to check for minimum value
small=x;
else if((y<x)&&(y<z))
small=y;
else
small=z;
*max=big; //pointer pointing to maximum value
*min=small; //pointer pointing to minimum value
}
int main()
{
int big,small;
MinMax(43,29,100,&big,&small);
cout<<"Max is "<<big<<"\\Min is "<<small; //big and small variables will get value from method called
return 0;
}
OUTPUT :
Max is 100
Min is 29
Step-by-step explanation:
When the method is called from first three integers maximum will be found using the conditions imposed and maximum value will be found and similarly will happen with the minimum value.