What is the C++ function to raise a number to a power?

user98188 picture user98188 · May 10, 2009 · Viewed 534.6k times · Source

How do I raise a number to a power?

2^1

2^2

2^3

etc...

Answer

Joey Robert picture Joey Robert · May 10, 2009

pow() in the cmath library. More info here. Don't forget to put #include<cmath> at the top of the file.