Advertisement
evcamels

lab-1

Jan 19th, 2021
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.50 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4. class qudrangle {
  5. float x1,x2,x3,x4;
  6. public:
  7. void set(float x1, float x2, float x3, float x4){
  8. this->x1 = x1;
  9. this->x2 = x2;
  10. this->x3 = x3;
  11. this->x4 = x4;
  12. }
  13. void ex(){
  14. if(x1 < x2+x3+x4 && x2 < x1+x3+x4 && x3 < x1+x3+x4 && x4< x1+x2+x3){
  15. cout << "Четырехугольник существует!" << endl;
  16. }else cout << "Четырехугольник не существует!" << endl;
  17. }
  18. void inf(){
  19. cout << "Длина а = " << x1 << endl;
  20. cout << "Длина b = " << x2 << endl;
  21. cout << "Длина с = " << x3 << endl;
  22. cout << "Длина d = " << x4 << endl;
  23. cout << "Периметр = " << x1+x2+x3+x4 << endl;
  24. cout << "Площадь = " << x1*x2 << endl;
  25. cout << "Диагональ = " << sqrt(x1*x1+x2*x2) << endl;
  26. }
  27. float s(){
  28. return sqrt(x1*x1+x2*x2);
  29. }
  30. };
  31. class trap : public qudrangle{
  32. float a,b,c,d;
  33. public:
  34. void set1(float a, float b, float c, float d){
  35. this->a = a;
  36. this->b = b;
  37. this->c = c;
  38. this->d = d;
  39. }
  40. void prov(){
  41. if(a == c && b == d && a != d && b != c){
  42. cout << "Это трапеция!" << endl;
  43. }else cout << "Не трапеция!" << endl;
  44. }
  45. float s1(){
  46. return a*b;
  47. }
  48. };
  49. int main() {
  50. int n,m;
  51. float a,b,c,d, count = 0, count1 = 0, count2 = 999999, max = 0;
  52. cin >> n >> m;
  53. for(int i=0;i<n;i++){
  54. trap q;
  55. cin >> a >> b >> c >> d;
  56. q.set(a,b,c,d);
  57. for(int i=0;i<n;i++){
  58. if(q.s() > max){
  59. max = q.s();
  60. }
  61. if(q.s() == max){
  62. count++;
  63. }
  64. }
  65. }
  66. for(int i=0;i<m;i++){
  67. trap p;
  68. cin >> a >> b >> c >> d;
  69. p.set1(a,b,c,d);
  70. for(int i=0;i<m;i++){
  71. if(p.s1() > count1){
  72. count1 = p.s1();
  73. }
  74. if(p.s1() < count2){
  75. count2 = p.s1();
  76. }
  77. }
  78. }
  79. cout << "Маскимальная площадь четырехугольников: " << max << endl;
  80. cout << "Количество четырехугольников с макимальной площадью: " << count << endl;
  81. cout << "Минимальная площадь трапеции: " << count2 << endl;
  82. return 0;
  83. }
  84.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement