Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main()
- {
- float a,b,c = 0;
- float x1 = 0;
- float x2 = 0;
- float delta = 0;
- cout << "Podaj a: ";
- cin >> a;
- cout << "\nPodaj b: ";
- cin >> b;
- cout << "\nPodaj c: ";
- cin >> c;
- //ax^2 + bx + c = 0
- //bx + c = 0
- //bx = 0-c
- //x = (0-c)/b
- if(a == 0)
- {
- x = (-1*c)/b;
- }
- else
- {
- delta = (-1*b)^2 - (4 * a * c);
- if(delta > 0)
- {
- x1 = (-1*b - sqrt(delta)) / (2*a);
- x2 = (-b + sqrt(delta)) / (2*a);
- }
- if(delta == 0)
- {
- x = (-b)/(2*a);
- }
- if()
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement