Advertisement
Guest User

tut1.2

a guest
Mar 5th, 2015
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. double a,b,c;
  9. cout << "Unesi tri broja ";
  10. cin >> a >> b >> c;
  11.  
  12. if(a+b>c && a+c>b && c+b>a)
  13. {
  14. double maxi=0;
  15. double s = (a+b+c)/2;
  16. double P = sqrt(s*(s-a)*(s-b)*(s-c));
  17.  
  18. //c2=a2+b2–2ab cosy
  19.  
  20. double alfa = acos((pow(a,2)+pow(b,2)-pow(c,2))/(2*a*b));
  21. double beta = acos((pow(a,2)+pow(c,2)-pow(b,2))/(2*a*c));
  22. double gama = acos((pow(c,2)+pow(b,2)-pow(a,2))/(2*c*b));
  23. if (alfa > beta && alfa > gama)
  24. maxi = alfa;
  25. else if(beta >= alfa && beta >= gama)
  26. maxi = beta;
  27. else if (gama >= beta && gama >= alfa)
  28. maxi = gama;
  29. double PI = 4 * atan(1);
  30. double step = 180 * maxi / PI;
  31. double stepen = int(step);
  32. double minuts = (step - stepen) * 60;
  33. double minute = int (minuts);
  34. double sekunde = (minuts - minute) * 60;
  35. double sekund = int (sekunde);
  36.  
  37. cout << "Povrsina =" << P << "njegov najveci ugao iznosi " << " " << stepen << " " <<minute << " " << sekund;
  38.  
  39. }
  40.  
  41. else cout << "ne postoji ugao sa stranicama"<< a << " " << b << " " << c ;
  42.  
  43. return 0;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement