标签:题目 else 浮点 content desc span title exp solution
class Solution { public: double Power(double base, int exponent) { if(base==1.0) return 1.0; if(exponent==0) return 1.0; double temp=1.0; if(exponent>0) { while(exponent) { temp = temp*base; exponent--; } } else{ while(exponent) { temp =temp/base; exponent++; } } return temp; } };
标签:题目 else 浮点 content desc span title exp solution
原文地址:https://www.cnblogs.com/loyolh/p/12347092.html