Facebook
From Big Penguin, 6 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 217
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include<math.h>
  4. #include <cmath>
  5. #include <cstdio>
  6.  
  7.  
  8. using namespace std;
  9.  
  10. int main()
  11. {
  12.    // int tab[8]={-5,-10,-20,-25,-30,-35,-10,-5};
  13.     int tab[8];
  14.    double a=0,b,c=0,d=0,e=0,f=0;
  15.  
  16.     //wprowadzanie danych
  17.     for( int i = 0; i <= 7; i++ )
  18.    {
  19.       cin>>tab[i];
  20.    }
  21.     a=abs( sqrt((pow((tab[2]-tab[0]),2))+(pow((tab[3]-tab[1]),2))));
  22.     b=abs( sqrt((pow((tab[2]-tab[4]),2))+(pow((tab[3]-tab[5]),2))));
  23.     c=abs( sqrt((pow((tab[4]-tab[6]),2))+(pow((tab[5]-tab[7]),2))));
  24.     d=abs( sqrt((pow((tab[6]-tab[0]),2))+(pow((tab[7]-tab[1]),2))));
  25.     e=abs( sqrt((pow((tab[4]-tab[0]),2))+(pow((tab[5]-tab[1]),2))));
  26.     f=abs( sqrt((pow((tab[6]-tab[2]),2))+(pow((tab[7]-tab[3]),2))));
  27.  
  28.  
  29.   //  cout <<a<<"  " <<b<<"  " <<c<<"  " <<d<<"  " <<e<<"  " <<f<<endl;
  30.  
  31.    // cout<<(a*c)+(d*b)<<" * "<<(e*f)<<endl;
  32.     // cout << (a+c)<<" + "<<(b+d)<<endl;
  33.      
  34.      float pier = a*c;
  35.     float  drug = d*b;
  36.      
  37.     float trze = e*f;
  38.      float sum = pier+drug;
  39.      
  40.      
  41.     if(abs(sum-trze)<0.00001)
  42.     {
  43.          cout<<"True"<<endl;
  44.     }
  45.  
  46.     else
  47.     {
  48.         cout<<"False"<<endl;
  49.     }
  50.     if(abs(pier-drug)< 0.00001)
  51.     {
  52.          cout<<"True"<<endl;
  53.     }
  54.  
  55.     else
  56.     {
  57.         cout<<"False"<<endl;
  58.     }
  59.  
  60.     return 0;
  61. }