+ 1
i found a challenge where a pow was added. what is this pow?
3 Respostas
+ 3
pow() is a function in C/C++ defined in <math> header which is used to calculate power of a number
For example
pow(2,3) is same as 2^3 in maths
pow(2,3) == 2*2*2 == 8
+ 3
Samsil Arefeen it's not necessary to use <cmath> header file, you can also use good old <math.h> header file in C++.
The main difference between them is <cmath> defines symbols in the std namespace, and may also define symbols in the global namespace whereas <math.h> defines symbols in the global namespace, and may also define symbols in the std namespace.
take this for example👇
https://code.sololearn.com/cV94WiY32z37/?ref=app
+ 1
Thanks Arsenic. I didn't know that.