fork download
  1. #include <iostream>
  2. #include <cmath>
  3.  
  4. using namespace std;
  5.  
  6. float a,b,c,w1,w2,w3,wS;
  7.  
  8. float Angle(float b1,float b2,float b3){
  9. float katRad = acos((pow(b1,2)+pow(b2,2)-pow(b3,2))/(2*b1*b2));
  10. float katSt = katRad * 180 / M_PI;
  11. return katSt;
  12. }
  13.  
  14. int main() {
  15. cin >> a >> b >> c;
  16. w1 = Angle(a,b,c);
  17. w2 = Angle(c,a,b);
  18. w3 = Angle(b,c,a);
  19. wS = w1+w2+w3;
  20. cout << "Kat 1: " << w1 << endl;
  21. cout << "Kat 2: " << w2 << endl;
  22. cout << "Kat 3: " << w3 << endl;
  23. cout << "Suma Katow: " << wS << endl;
  24. if(wS==180){
  25. cout << "Suma Poprawna" <<endl;
  26. }else{
  27. cout << "Suma niepoprawna" << endl;
  28. }
  29. return 0;
  30. }
Success #stdin #stdout 0s 4420KB
stdin
1.41
1.41
2
stdout
Kat 1: 90.343
Kat 2: 44.8285
Kat 3: 44.8285
Suma Katow: 180
Suma Poprawna