Comparing four number for min

I have four numbers and I need to find the min, but the min cannot be zero. What would be a simple algorithm for that?

I originally used the std:min() but then I realized if
1
2
3
4
5
6
x=0;
y=1;
z=2;
t=6;
min(x,y)
min(z,t)

I won't get the min I actually need. I also have to keep in mind that more than one variable can be 0
Set min to be the first variable. Then check if second variable is less than min; if it is, make that the new min. Repeat for third and fourth variable.
Last edited on
if there is a zero that does not work. My min can't be zero
Last edited on
The check each value to make sure it's larger than 0.
Topic archived. No new replies allowed.