用库函数求一个整数的立方,再调用函数求1到10相邻两个整数的立方差,c++
使用pow函数pow(x,3)
#include <iostream>
#include <math>
using namespace std;
int fun(int n)
{
return pow(n,3);
}
int main()
{
for(int i=1;i<=9;i++)
{
cout<<fun(i+1) - fun(i)<<endl;
}
return 0;
}