标签:exp double subject pow style ase tmp return esc
class Solution { public: double Power(double base, int exponent) { double rt=1.0; int tmp=exponent; if(exponent == 0 )return 1; if(exponent <0 ) tmp=(-exponent); for(int i=1;i<=tmp ;i++) { rt*=base; } if(exponent < 0 ) { rt=(1/rt); } return rt; } };
标签:exp double subject pow style ase tmp return esc
原文地址:http://www.cnblogs.com/Berryxiong/p/6148437.html