+ 1

How do I calculate exponentials in C++?

For example, 2 to the power of 4.

23rd Dec 2016, 2:05 AM
Erik Johanson
Erik Johanson - avatar
2 ответов
+ 1
The math header in the standard library has a pow function that can do this. For example pow(2, 4) == 16
23rd Dec 2016, 2:50 AM
James Durand
James Durand - avatar
0
//this is an example #include <math.h> #include<iostream> using namespace std; int main() { double param, result; param = 5.0; cout<< pow(param, 2); system("pause"); return 0; }
23rd Dec 2016, 4:33 AM
Jean Carlos Arauz
Jean Carlos Arauz - avatar