The pow()
function computes a base number raised to the power of an exponent.
The pow()
function takes two arguments, a base and an exponent. Both of these arguments have to be of type double
.
double result = pow(base, exponent);
The code below illustrates the use of the pow()
function.
#include <iostream>using namespace std;#include <bits/stdc++.h>int main() {cout<<"4 ^ 3 = "<< pow(4.0, 3.0)<<endl;cout<<"2.65 ^ 4.5 = "<< pow(2.65, 4.5)<<endl;return 0;}
Free Resources