练习专区

今天的一小步就是明天的一大步
Problem 1320 求定积分的通用函数
Accepted: 2   Total Submit: 3
Time Limit: 1000ms   Memory Limit: 30720KB
Description
一个用矩形法求定积分的通用函数,分别求 通用函数原型为 float integral(float(*fun)(float), float a,float b, int n); a,b积分上下限,n为等分数。
Input
输入若干种情况,每种情况输入a,b,n;a和b表示积分上限和下限,n表示等分数。
Output
对于每种情况,分别输出三种函数在[a,b]上的积分。
Sample Input
0 1 20
Sample Output
The integral of sin(x) is:0.480639
The integral of cos(x) is:0.829803
The integral of exp(x) is:1.761597
Hint
提交     返回