I'm writing a simple program that takes two values and raises the first to the power of the second. The compiler is underlining that last "else" and giving me the error "expected a statement." The syntax looks okay to me. I'm sure it's a simple mistake. Thanks for any help!
int main()
{
int base;
int power;
cout << "Please enter a base integer and the power integer you would like to raise it to.\n";
cin >> base >> power;
double result = base;
if (power == 0)
cout << "The resulting value is 1\n";
elseif (power > 1);
{
for (int i = 1; i < power; i++)
result *= base;
cout << "The resulting value is " << result << "\n";
}
else
{
result = 1;
for (int i = -1; i > power; i--)
result /= base;
cout << "The resulting value is " << result << "\n";
}
}