CodePudding user response:
# include# include
Int main ()
{double integral, double (double) (*), double, double, int n);
Double fsin (double);
Double fcos (double);
Double a1, b1 and a2, b2, c, (* p) (double);
Int n=20;
Printf (" input a1, b1: ");
Lf the scanf (" % % lf ", & amp; A1, & amp; B1);
Printf (" input a2, b2: ");
Lf the scanf (" % % lf ", & amp; A2, & amp; B2);
P=fsin;
C=integral (p, a1, b1, c);
Printf (" The integral of sin (x) is: % lf \ n ", c);
P=fcos;
C=integral (p, a2, b2, c);
Printf (" The integral of cos (x) is: % lf \ n ", c);
return 0;
}
Double integral, double (* p) (double), double a, double b, int n)
{
int i;
Double x, h, s,
H=(b - a)/n;
X=a;
S=0;
for(i=1; i<=n; I++)
{x=x + h;
S=s + (* p) (x) * h;
}
The return (s);
}
Double fsin (double x)
{
Return sin (x);
}
Double fcos (double x)
{
Return cos (x);
}
CodePudding user response:
There are a great god help to improve itCodePudding user response:
Are there any big don't sinkCodePudding user response:
your question is too complicated!CodePudding user response:
The