Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.28 KB | None | 0 0
  1. #include <cstdlib>
  2. #include <iostream>
  3. #include <cmath>
  4.  
  5. using namespace std;
  6.  
  7. double a,b,c;
  8.  
  9. int main()
  10. {
  11.  
  12.   cout<<"Podaj dlugosc pierwszego odcinku"<<endl;
  13.   cin>>a;
  14.   cout<<"Podaj dlugosc drugiego odcinku"<<endl;
  15.   cin>>b;
  16.   cout<<"Podaj dlugosc trzeciego odcinku"<<endl;
  17.   cin>>c;
  18.     if( a < b+c and b < a+c and c< a+b)
  19.       {
  20.         cout<<"Z podanych odcinkow mozna zbudowac trojkat";              
  21.           if( a == b == c)
  22.             {
  23.               cout<<" rownoboczny"<<endl;
  24.             }
  25.           else if ( a == b and  a!= c or a == c and  c!= b or b == c and  b!= a)
  26.             {
  27.               cout<<" rownoramienny"<<endl;
  28.               if ( pow(a,2)==pow(b,2)+pow(c,2) or pow(b,2)==pow(a,2)+pow(c,2)
  29.               or pow(c,2)==pow(a,2)+pow(b,2)) cout<<"bedacy jednoczesnie prostokatnym"<<endl;                                
  30.             }
  31.           else if ( a*a==b*b+c*c or b*b==a*a+c*c or c*c==a*a+b*b )
  32.             {
  33.               cout<<" prostokatny"<<endl;
  34.             }
  35.           else if (a != b and a != c and b != c)
  36.             {
  37.               cout<<" roznoboczny"<<endl;
  38.             }    
  39.       }
  40.     else cout<<"Z danych odcinkow nie można zbudowac trojkata"<<endl;
  41.        
  42.   system("pause");      
  43.   return EXIT_SUCCESS;      
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement