class Solution {
public:
double Power(double base, int exponent) {
double res = 1;
if(exponent == 0){
if(base == 0){
return -1;
}
else{
return 1;
}
}
else{
for( int i = 0; i < abs(exponent); i++){
res *= base;
}
if(exponent < 0){
res = 1/res;
}
}
return res;
}
};