vc++算乘方,出错 了!!!急等答案

来源:百度知道 编辑:UC知道 时间:2024/06/18 15:37:00
在vc++上运行,c++程序,用乘方pow出错,c2268:'pow' 为什么啊?大家帮忙看看

#include <stdio.h>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <stdlib.h>
#include <math.h>

using namespace std;

int main()
{
cout<<"100\n";

int i,j,N;
N=pow(2,3);
}

你调用pow参数不对
pow有多种重载方式,但不包括输入参数都是int型的

你可以试一试
cout<<"100\n";

long double N;

N=pow(2.0,3);

没有错啊,在VC6.0中不会有错的。
你用pow()的头文件(math.h)已加入,可以调用了,传的参数也对。

只是你的main函数应该反回一个值,因为你是的是int main();如果不要返回值,可改为void main()
还有两个变量没有用到(i,j)