Search:
Forum
Beginners
fmin/fmax
fmin/fmax
May 11, 2010 at 8:34pm UTC
petergrwl
(14)
hi, need to write fmin and fmax functions
can anyhelp help implementing?
would this work?
double fmin(double a,double b)
{
return (a<b)?a:b;
}
double fmax(double a,double b)
{
return (b<a)?a:b;
}
thanks
May 11, 2010 at 8:49pm UTC
PanGalactic
(1658)
Yes, except I would say a fmax() would read better as a>b rather than b<a. The former is instantly understandable while the latter takes a moment for one to recognize and process.
Topic archived. No new replies allowed.
C++
Information
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs