Advertisement
Guest User

kwadratowa_complex.cpp

a guest
Jan 19th, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. #include <iostream>
  2. #include<math.h>
  3. using namespace std;
  4.  
  5. int kwadratowa(float a,float b,float c)
  6. {
  7.  
  8. float delta;
  9. float wynik1,wynik2;
  10. if(!a)
  11. {
  12. cout<<"To nie jest funkcja kwadratowa."<<endl;
  13. }
  14.  
  15. else{ delta=(pow(b,2))-(4*a*c);
  16.  
  17. if(delta==0)
  18. { wynik1=(-b) /2*a;
  19. cout<<"Wynikiem rownania jest: "<<wynik1;
  20. }
  21.  
  22. else if (delta>0)
  23. { wynik1=(sqrt(delta)-b )/(2*a);
  24. wynik2=(-(sqrt(delta))-b )/(2*a);
  25. cout<<"Wynikiem rowania jest: "<<wynik1<<" i "<<wynik2;
  26. }
  27.  
  28.  
  29. else
  30. {
  31. cout<<"Rownanie nie ma rozwiazania w zbiorze liczb rzeczywistych."<<endl;
  32. }
  33.  
  34.  
  35.  
  36. }
  37. return 0;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement