Advertisement
Guest User

Untitled

a guest
Mar 18th, 2019
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. // Miejsca zerowe.cpp: Określa punkt wejścia dla aplikacji konsoli.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include <iostream>
  6. #include <math.h>
  7.  
  8. using namespace std;
  9.  
  10. int _tmain(int argc, _TCHAR* argv[])
  11. {
  12. double dolna, gorna, srodek, a, yd, ys;
  13. cout << "Podaj granice dolna: ";
  14. cin >> dolna;
  15. cout << "Podaj granice gorna: ";
  16. cin >> gorna;
  17. cout << "Podaj a: ";
  18. cin >> a;
  19. yd = 3 * exp(dolna) - 2 * dolna*dolna - 100;
  20. while (gorna - dolna > a)
  21. {
  22. srodek = dolna + (gorna - dolna) / 2;
  23. ys = 3 * exp(srodek) - 2 * srodek*srodek - 100;
  24. if (yd*ys <= 0)
  25. gorna = srodek;
  26. else
  27. {
  28. dolna = srodek;
  29. yd = ys;
  30. }
  31.  
  32. }
  33. double x0;
  34. x0 = dolna + (gorna - dolna) / 2;
  35. cout << srodek<< endl;
  36.  
  37. return 0;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement