Advertisement
Guest User

Untitled

a guest
Dec 7th, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. double pole(double, double,double);
  6. double f(double);
  7. int main() {
  8. std::cout << pole(0.1,3.14,0.1);
  9. return 0;
  10. }
  11.  
  12. double pole(double dol,double gora, double dokladnosc)
  13. {
  14. double wynik = 0;
  15. for(double i = dol; i < gora; i+= dokladnosc)
  16. {
  17. wynik += (f(i)+f(i+dokladnosc))*dokladnosc/2;
  18. }
  19. return wynik;
  20. }
  21.  
  22. double f(double arg)
  23. {
  24. return sin(arg);
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement