The fmax()
function is defined in the <cmath>
header file.
double fmax (double x, double y);float fmax (float x, float y);long double fmax (long double x, long double y);
#include <iostream>#include <cmath>using namespace std;int main(){double x = -2.05, y = -3.5, result;result = fmax(x, y);cout << "fmax(x, y) = " << result << endl;return 0;}
#include <iostream>#include <cmath>using namespace std;int main(){// using different argument typesdouble x = 89.1, result;int y = 89;result = fmax(x, y);cout << "fmax(89.1, 89) = " << result << endl;return 0;}