在家自学c 新手..看到报错就慌了啊
main(){
double q=pi(1.0);
printf("%f\n",q);
}
double pi(double eps)
{
double s=0.0,t=1.0;
int n;
for(n=1;t>eps;n++)
{
s+=t;
t=n*t/(2*n+1);
}
return (2.0*s);
}
报的是
D:\VC++6.0\Microsoft Visual Studio\MyProjects\firstPrint\printCCCCC.cpp(364) : error C2065: 'pi' : undeclared identifier
D:\VC++6.0\Microsoft Visual Studio\MyProjects\firstPrint\printCCCCC.cpp(370) : error C2373: 'pi' : redefinition; different type modifiers
帮忙看看吧 为什么说pi没有定义啊?