function integer power ( base , exponent ) that returns the value of base exponent
#include <iostream>
#include <cmath>
using namespace std;
long integer_power (int base, int exponent) {
return pow(base, exponent);
}
int main () {
int a, b;
cout << "Enter a base: "; cin >> a;
cout << "Enter a exponent: "; cin >> b;
cout << "The " << a << "^" << b << " = " << integer_power(a, b);
return 0;
}
Comments
Leave a comment