#include <iostream>
int main() {
std::cout << "powering base to power" << std::endl
<< "Enter base <space> power" << std::endl;
double b, p;
std::cin >> b, p;
int sum = b;
while(p > 0)
{
sum = sum * sum;
p = p - 1;
}
std::cout << "The result is : " << sum;
return 0;
}
Also, this will only work with integral powers. If the user inputs a power of 0.5 you'd be expected to calc the square root. Since that's not allowed here, you'd be better off making 'p' an int rather than a double.
Anyway... all that aside.... is there any reason you can't use the pow function in the <cmath> header? It already does this. Or is the assignment to do this yourself without using that header?