Advertisement
Guest User

A.E.y

a guest
Oct 16th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6. long long n;
  7. cin>>n;
  8. for(int i=1;i<=n;++i)
  9. {
  10. double x1,y1,x2,y2,x3,y3,x4,y4,a,b,c,d,e,f;
  11. cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
  12. a=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
  13. b=sqrt((x2-x3)*(x2-x3)+(y2-y3)*(y2-y3));
  14. c=sqrt((x3-x4)*(x3-x4)+(y3-y4)*(y3-y4));
  15. d=sqrt((x1-x4)*(x1-x4)+(y1-y4)*(y1-y4));
  16. e=sqrt((x1-x3)*(x1-x3)+(y1-y3)*(y1-y3));
  17. f=sqrt((x2-x4)*(x2-x4)+(y2-y4)*(y2-y4));
  18. if (a==b&&b==c&&c==d)
  19. {
  20. if (e==f)
  21. cout<<"Case "<<i<<": Square"<<endl;
  22. else
  23. cout<<"Case "<<i<<": Rhombus"<< endl;
  24. }
  25. else
  26. {
  27. if (a==c&&b==d)
  28. cout<<"Case "<<i<<": Rectangle"<<endl;
  29. else
  30. cout<<"Case "<<i<<": Other"<<endl;
  31. }
  32. }
  33. return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement