用法:#include
功能:计算x的y次幂。
说明:x应大于零,返回幂指数的结果。
举例:
// pow.c
#include
#include
main()
{
clrscr(); // clear screen
textmode(0x00); // 6 lines per lcd screen
printf(4^5=%f,pow(4.,5.));
getchar();
return 0;
}
1,要加入头文件 math.h
2,pow(x,y);//其作用是计算x的y次方。x、y及函数值都是double型
例:
我要计算2的5次方
源代码如下:
#includestdio.h
#includemath.h
main()
{
long total;
int x = 2, y = 5;
total = pow(x,y); /*调用pow函数*/
printf(%ld,total);
getch();
}
原型:extern float pow(float x, float y);
用法:#include
功能:计算x的y次幂。
说明:x应大于零,返回幂指数的结果。
举例:
// pow.c
#include
#include
main()
{
clrscr(); // clear screen
textmode(0x00); // 6 lines per lcd screen
printf(4^5=%f,pow(4.,5.));
getchar();
return 0;
}
