C language-the three values replace the original values in ascending order

Requirements are as follows

 

Implementation code

 

 Text code

void prtf(double * a,double * b,double *c){
double max,min,th;
max=*a>(*b>*c?*b:*c)?*a:(*b>*c?*b:*c);
min=*a<(*b<*c?*b:*c)?*a:(*b<*c?*b:*c);
th=(max==*a?*b:*a)==min?*c:(max==*a?*b:*a);
*c=max;
*b=th;
*a=min;
}

 

Guess you like

Origin www.cnblogs.com/Let-us-Coding/p/12760712.html