+ 1
How do I calculate exponentials in C++?
For example, 2 to the power of 4.
2 Answers
+ 1
The math header in the standard library has a pow function that can do this. For example pow(2, 4) == 16
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;
}