how find that with two comparisons
??
how find that with two comparisons
??
edit
like this?
Code:if(strcmp(f1,f2)>0) { if (strcmp(f2,f3)>0) smallest is f3 } else { if (strcmp(f1,f3)>0) smallest is f3 }
Yes, you are getting closer, but you are not there yet. Think about the cases where f1 and f2 are the smallest.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
but still in the inner if i could get <0
so there i need to add another else
which is the same if
like this?Code:if(strcmp(f1,f2)>0) { if(strcmp(f2,f3)>0) { return f3; } else { return f2 } } else { if(strcmp(f1,f3)>0) { return f3; } else { return f1 } }
Yes, but don't just take my word for it: test it yourself.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)