Advertisement
carsit

Untitled

Aug 29th, 2014
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. int a, b, c, delta;
  9. double x,y;
  10. cout << "inserisci il primo termine x^2: ";
  11. cin >> a;
  12. cout << "inserisci il secondo termine x: ";
  13. cin >> b;
  14. cout << "inserisci il terzo termine noto: ";
  15. cin >> c;
  16. delta = b^2 * (4*a*c);
  17. cout << "il delta e' :"<< delta;
  18. if (delta==0){
  19. x= (-(b)-(sqrt (delta))) /(2*a);
  20. y= (-(b)+ (sqrt (delta))) /(2*a);
  21. cout << "\nLe soluzioni sono coincidenti: x1= " << x << " e x2= " << y;
  22. } else if (delta >0) {
  23. x = (-(b)-(sqrt (delta))) /(2*a);
  24. y = (-(b)+(sqrt (delta))) /(2*a);
  25. cout << "\nLe soluzioni sono: x1= " << x << " e x2 = " << y;
  26. }else if (delta <0) {
  27. cout << "\nNon esistono soluzioni";
  28. }
  29. return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement