Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Miejsca zerowe.cpp: Określa punkt wejścia dla aplikacji konsoli.
- //
- #include "stdafx.h"
- #include <iostream>
- #include <math.h>
- using namespace std;
- int _tmain(int argc, _TCHAR* argv[])
- {
- double dolna, gorna, srodek, a, yd, ys;
- cout << "Podaj granice dolna: ";
- cin >> dolna;
- cout << "Podaj granice gorna: ";
- cin >> gorna;
- cout << "Podaj a: ";
- cin >> a;
- yd = 3 * exp(dolna) - 2 * dolna*dolna - 100;
- while (gorna - dolna > a)
- {
- srodek = dolna + (gorna - dolna) / 2;
- ys = 3 * exp(srodek) - 2 * srodek*srodek - 100;
- if (yd*ys <= 0)
- gorna = srodek;
- else
- {
- dolna = srodek;
- yd = ys;
- }
- }
- double x0;
- x0 = dolna + (gorna - dolna) / 2;
- cout << srodek<< endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement