integral_1.cpp
来自「Topics Practices: Programming and Nume」· C++ 代码 · 共 101 行
CPP
101 行
#include<stdio.h>
#include<conio.h>
#include<math.h>
float f(float x)
{
return 3*x*x;
}
float integral(float a, float b, float h)
{
float x,suma;
suma=0;
for(x=a; x<=b; x=x+h)
suma=suma+h*f(x);
return suma;
}
main()
{
float a,b,h,area;
printf("Ingrese el extremo izquierdo: ");
scanf("%f", &a);
printf("Ingrese el extremo derecho: ");
scanf("%f", &b);
for(h=0.1; h>=1e-10; h=h/10)
{
area=integral(a,b,h);
printf("Para h= %f el area es: %f \n",h,area);
}
printf("Gracias por utilisar nuestro metodo de integracion \n");
getch();
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?