Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <conio.h>
- #include <math.h>
- using namespace std;
- int main()
- {
- long double x,a,b,c,delta,x1,x2;
- cout<<"Obliczanie fukcji krwadratowej."<<endl;
- cout<<"Podaj a: ";
- cin>>a;
- cout<<"Podaj b: ";
- cin>>b;
- cout<<"Podaj c: ";
- cin>>c;
- delta= b*b-4(a*c);
- if (delta<0)
- {
- cout<<"Wartosc delty to: "<<delta<<endl;
- cout<<"Taka delta nie istnieje. Podaj inne wspolczynniki."<<endl;
- }
- else if (delta=0)
- {
- x= -b/2*a;
- cout<<"Wartosc delty: "<<delta<<endl;
- cout<<"Wartosc x: "<<x<<endl;
- }
- else
- {
- x1= -b-sqrt(delta)/2*a;
- x2= -b+sqrt(delta)/2*a;
- cout<<"Wartosc delty: "<<delta<<endl;
- cout<<"Wartosc x1: "<<x1<<endl;
- cout<<"Wartosc x2: "<<x2<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement