C++中如何输入X的3次方?

来源:百度知道 编辑:UC知道 时间:2024/05/27 01:58:20
要有右上方脚标的那种,谢谢!

x的3次方:X*X*X

x的N次而有信方:pow(x,n)

  C++中如何输入X的3次方有两种方法:
  1、连乘 a的3次方表示成:a*a*a;
    2、pow(a,3)表示a的3次方,但是需要引入math.h头文件
  例如求5的3次方:
  #include <iostream>
#include<stdio.h>
#include<math.h>
using namespace std;
int main()
{
int a=5,b,c;
b=a*a*a;//方法一
c=pow(a,3);//方法二
printf("%d ",b);
printf("%d ",c);
return 0;
}

可是“右上方脚标”不是X的几次方。

pow(x,3);
pow(x,3);
pow(x,3);

#include<cmath>

我用的2008 在调用的时候 对POW的重载

要求类型 为浮点型的 不知道其他的怎么样

pow(x,3);

pow(x,3);