## C++ Power Operator

Last Updated On
Monday 23rd May 2022

## C++ Power Operator

The power function looks like pow() inside we put argument ten and raise it to the second power pow(10,2) return 100.

### pow() Syntax

The syntax of the pow() function is:

	pow(double base, double exponent);



### pow() Parameters

The pow() function takes two parameters:

• base – the base value
• exponent – exponent of the base

## C++ Power

### Use Power Operator in c++

pow() function is not made available to us. By default, we need to import <cmath>

	#include <iostream>
#include <cmath>

using std::cout;
using std::cin;

int main() {
int base, exponent;
cout << "Enter Base : ";
cin >> base;
cout << "Enter Exponent : ";
cin >> exponent;
cout << pow(base, exponent);
}



output :

	Enter Base : 2
Enter Exponent : 4
16



We get a huge number if we have pow(10,10) return 1e+10 1 times 10 to the 10th power.We can assign a variable to that.

	#include <iostream>
#include <cmath>

using namespace std;
int main() {
int base, exponent;
double result;
base = 6;
exponent = 2;
result = pow(base, exponent);
cout << result << endl;
return 0;
}



output 36

### References

c++ exponent
c power operator
power in c++
power c++
cpp power
c++ exponential operator
power operator in c++