Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- double pole(double, double,double);
- double f(double);
- int main() {
- std::cout << pole(0.1,3.14,0.1);
- return 0;
- }
- double pole(double dol,double gora, double dokladnosc)
- {
- double wynik = 0;
- for(double i = dol; i < gora; i+= dokladnosc)
- {
- wynik += (f(i)+f(i+dokladnosc))*dokladnosc/2;
- }
- return wynik;
- }
- double f(double arg)
- {
- return sin(arg);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement