C++ includes many math functions in its standard library. Here are some examples:
We have learn how to perform basic mathematic functions using arithmetic operators (for example +,-,*,/ etc.)
Square root: use the sqrt() function from the <cmath> library, for example:
#include
double result = sqrt(25); // result = 5.0
Power: use the pow() function from the <cmath> library, for example:
Trigonometric functions: use functions such as sin(), cos(), and tan() from the <cmath> library, for example:
#include
double result = pow(2, 3); // result = 8.0
Pi: use the M_PI constant from the <cmath> library, for example:
#include
double result = M_PI; // result = 3.14159
Infinity: use the INFINITY constant from the <cmath> library, for example:
#include
double result = INFINITY; // result = infinity
Learners TV is a website that is designed to educate users and provide instructional material on particular subjects and topics.