SHARE
TWEET

zad 5

a guest Oct 22nd, 2017 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <math.h>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     int a, b, c;
  9.     float p;
  10.     double s;
  11.     cout << "Podaj liczbe 1:";
  12.     cin >> a;
  13.     cout << "Podaj liczbe 2:";
  14.     cin >> b;
  15.     cout << "Podaj liczbe 3:";
  16.     cin >> c;
  17.     if (a<b+c&&b<a+c&&c<b+a)
  18.     {
  19.            if (((a*a+b*b==c*c) || (a*a+c*c==b*b) || (c*c+b*b==a*a))&&(a<b+c&&b<a+c&&c<b+a)) cout << "Trojkat prostokatny!" << endl;
  20.            else cout << "To jest trojkat!";
  21.            p=(a+b+c)/2;
  22.            s=sqrt(p*(p-a)*(p-b)*(p-c));
  23.            cout << "Pole: " << s;
  24.     }
  25.     else cout << "To nie jest trojkat!" << endl;
  26.  
  27.     return 0;
  28. }
RAW Paste Data
Top