#include<iostream>
using namespace std;
// Declare power function
int power(int x, int n);
// Start main function
int main()
{
// Declare main's variables
int number; int exponent;
// Get base and exponent
cout << "Enter number: ";
cin >> number;
cout << "Enter exponent: ";
cin >> exponent;
// Return base to the exponent power
cout << number << " to the " << exponent
<< "th power is " << power(number,exponent)
<< endl;
return 0;
}
// Define power function
// This function is "recursive" -- it calls itself
// Take in base and exponent, return base to the
// exponent power
int power(int base, int exp)
{
if (exp > 0)
return base * power(base,exp-1);
else
return 1;
}