Friday, August 23, 2013

If you wanted to use the inbuilt square root function in the C programming language, what would you have to do?

In the C programming language, the square root functionality is included in a library. To use this function, you must include the following compiler directive at the top of your program:


#include <math.h>


Having done so, the square root functionality is invoked using the "sqrt" function. For example,


y = sqrt(x);


would compute the square root of the value stored in variable x and store the result in variable y.


If you wish to use this C language functionality in the C++ language, the compiler directive is a bit different:


#include <cmath>


and the usage is the same as above.

No comments:

Post a Comment

What is the main function of the fool in &quot;King Lear&quot;? What is the secondly function?

The fool as a character is confusing, but part of this is the difference between the 1600s and today, as well as the difference in place. If...