Advertisement
Guest User

twoj_stary.exe

a guest
Oct 20th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. #include <iostream>
  2. #include <conio.h>
  3. #include <math.h>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. long double x,a,b,c,delta,x1,x2;
  9. cout<<"Obliczanie fukcji krwadratowej."<<endl;
  10. cout<<"Podaj a: ";
  11. cin>>a;
  12. cout<<"Podaj b: ";
  13. cin>>b;
  14. cout<<"Podaj c: ";
  15. cin>>c;
  16. delta= b*b-4(a*c);
  17. if (delta<0)
  18. {
  19. cout<<"Wartosc delty to: "<<delta<<endl;
  20. cout<<"Taka delta nie istnieje. Podaj inne wspolczynniki."<<endl;
  21. }
  22. else if (delta=0)
  23. {
  24. x= -b/2*a;
  25. cout<<"Wartosc delty: "<<delta<<endl;
  26. cout<<"Wartosc x: "<<x<<endl;
  27. }
  28. else
  29. {
  30. x1= -b-sqrt(delta)/2*a;
  31. x2= -b+sqrt(delta)/2*a;
  32. cout<<"Wartosc delty: "<<delta<<endl;
  33. cout<<"Wartosc x1: "<<x1<<endl;
  34. cout<<"Wartosc x2: "<<x2<<endl;
  35. }
  36. return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement