请教几个用法
这是今天上课遇到的一个程序,有些东西不大了解。。。。#include <stdio.h>
#include <math.h>
#include <conio.h>
double factorial(int);
double Term(double, int);
int main()
{ int I;
double dTemp, dEps, dx, dSin;
printf("Please enter a value of x:");
scanf("%lf",&dEps);
printf("Enter the accuracy value: ");
scanf("%lf",&dx);
while (dEps<=0)
{
printf("Input wrong! Enter Eps:");
scanf("%lf",&dEps);
}
printf("The Sin(x) is: %lf\n",sin(dx));
I=1;
dTemp =Term(dx, I);
dSin=0;
while(fabs(dTemp)>=dEps)
{
Sin=dSin+dTemp;
I=I+1;
dTemp=Term(x,I);
}
printf("Sin x is: %lf\n",Sin);
if(fabs(dTemp)<dEps)
printf("Looping stop at Term(%d) = %lf",I,dTemp);
printf("\n");
return 0;
}
double Factorial(int J)
{
int Z;
double Fac=1;
for(Z=1; Z<=J; Z++)
{
Fac=Fac*Z;
}
return (Fac);
}
double Term(double dx, int I)
{
int J=(2*I)-1;
double dTemp;
dTemp = (pow(dx,J))/Factorial(J);
if ((I%2)==0)
dTemp=-1*dTemp;
printf("I=%d J=%d Temp=%lf\n",I,J,dTemp);
return(dTemp);
}
1.在内int main之前的两个定义double factorial(int); double Term(double, int);是啥意思?
2.scanf("%lf",&dEps);中%后面的l是什么意思?
3.if(fabs(dTemp)<dEps)这个条件中的fabs指的什么?
4.double Factorial(int J)和double Term(double dx, int I)定义是什么意思?
希望前辈能解释一下。。。谢谢