class Solution {
public:
double Power(double base, int exponent) {
double sum=1;
if(exponent>0){
while(exponent){
sum*=base;
exponent--;
}
}
else if(exponent==0) return sum;
else{
while(exponent){
exponent++;
sum/=base;
}
}
return sum;
}
};
class Solution {
public:
double Power(double base, int exponent) {
double minus =1;
if(exponent<0) minus=-1,exponent=-exponent;
double res =1;
while(exponent--) res*=base;
if(minus<0) res = 1/res;
return res;
}
};