C++中10的几次方怎么表示?

如题所述

pow(10,x);表示10的x次方

注意需要在头文件中引入math.h

例如求10的3次方:

#include <iostream> 
#include<stdio.h>
#include<math.h>//引入math头文件
using namespace std;
 
int main()
{
    int x=3,a;
    a=pow(10,x);//计算10的3次方
    printf("%d ",a);
    return 0;
}
温馨提示:答案为网友推荐,仅供参考
第1个回答  2019-01-03

pow(10,x);表示10的x次方

注意需要在头文件中引入math.h

例如:求10的3次方:

#include <iostream> #include<stdio.h>#include<math.h>//引入math头文件using namespace std;  int main(){    int x=3,a;    a=pow(10,x);//计算10的3次方    printf("%d ",a);    return 0;}


扩展资料:

数学函数库,一些数学计算的公式的具体实现是放在math.h里,具体有:

1、double pow(double x,double y);计算x的y次幂

2、float powf(float x,float y); 功能与pow一致,只是输入与输出皆为单精度浮点数

3、double exp (double);求取自然数e的幂

4、double sqrt (double);开平方根

参考资料:百度百科-math.h

第2个回答  2015-09-20
1、C语言pow()函数: 头文件:#include pow() 函数用来求 x 的 y 次幂(次方),其原型为: double pow(double x, double y); pow()用来计算以x 为底的 y 次方值,然后将结果返回。设返回值为 ret,则 ret = xy。
相似回答