Some functions, such as
main, are not members of a class. These functions are called global functions. We introduce various functions from the
<cmath> header here to present the concept of global functions that do not belong to a particular class.
<cmath> header provides a collection of functions that perform common mathematical calculations. For example, you can calculate the square root of
900.0 with the function call
This expression evaluates to
sqrt takes an argument of type
double and returns a
double result. There’s no need to create any objects before calling function
sqrt. Also, all functions in the
<cmath> header are global functions—therefore, each is called simply by specifying ...