猜想程式中pow函数是怎么实现的?完全不懂求解
#include<stdio.h>#include<math.h>
int main()
{
double power(double a,double b);
double x=2.0 , y = 3.0;
double result;
result = pow(x,y);
printf("%lf raised to %lf is %lf\n",x,y,result);
} 循环呗
我只是路过打酱油的。 循环累加呗话说你纠结这个干嘛 以后会反汇编一看不就明白了 如梦幻泡影 发表于 2013-8-28 08:32 static/image/common/back.gif
循环呗
我只是路过打酱油的。
#include<stdio.h>
int main()
{
double power(double a,double b);
double x=2.0 , y = 3.0;
double result;
result = power(x,y);
printf("%lf raised to %lf is %lf\n",x,y,result);
}
double power(double a ,double b)
{
double c=1;
while(b<6)
{
c = c*a;
b++;
}
return c;
}
像这样吗?那么我不太理解题目所说的实现是什么意思啊 牡丹花下死做鬼 发表于 2013-8-28 08:55 static/image/common/back.gif
循环累加呗话说你纠结这个干嘛 以后会反汇编一看不就明白了
#include<stdio.h>
int main()
{
double power(double a,double b);
double x=2.0 , y = 3.0;
double result;
result = power(x,y);
printf("%lf raised to %lf is %lf\n",x,y,result);
}
double power(double a ,double b)
{
double c=1;
while(b<6)
{
c = c*a;
b++;
}
return c;
}
题目所说的实现是什么意思呢
页:
[1]