write a C++ function clip (lo,x,hi) that returns lo if x is less than lo; hi if x is greater than hi; and x otherwise for this problem you can assume that lo<hi.
1
Expert's answer
2012-11-21T11:17:56-0500
#include <stdio.h> #include <conio.h>
int clip(int lo, int x, int hi) { if (lo < hi) { & if (x < lo) & return lo; & if (x > hi) & return hi; } return x; }
Comments