Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- class qudrangle {
- float x1,x2,x3,x4;
- public:
- void set(float x1, float x2, float x3, float x4){
- this->x1 = x1;
- this->x2 = x2;
- this->x3 = x3;
- this->x4 = x4;
- }
- void ex(){
- if(x1 < x2+x3+x4 && x2 < x1+x3+x4 && x3 < x1+x3+x4 && x4< x1+x2+x3){
- cout << "Четырехугольник существует!" << endl;
- }else cout << "Четырехугольник не существует!" << endl;
- }
- void inf(){
- cout << "Длина а = " << x1 << endl;
- cout << "Длина b = " << x2 << endl;
- cout << "Длина с = " << x3 << endl;
- cout << "Длина d = " << x4 << endl;
- cout << "Периметр = " << x1+x2+x3+x4 << endl;
- cout << "Площадь = " << x1*x2 << endl;
- cout << "Диагональ = " << sqrt(x1*x1+x2*x2) << endl;
- }
- float s(){
- return sqrt(x1*x1+x2*x2);
- }
- };
- class trap : public qudrangle{
- float a,b,c,d;
- public:
- void set1(float a, float b, float c, float d){
- this->a = a;
- this->b = b;
- this->c = c;
- this->d = d;
- }
- void prov(){
- if(a == c && b == d && a != d && b != c){
- cout << "Это трапеция!" << endl;
- }else cout << "Не трапеция!" << endl;
- }
- float s1(){
- return a*b;
- }
- };
- int main() {
- int n,m;
- float a,b,c,d, count = 0, count1 = 0, count2 = 999999, max = 0;
- cin >> n >> m;
- for(int i=0;i<n;i++){
- trap q;
- cin >> a >> b >> c >> d;
- q.set(a,b,c,d);
- for(int i=0;i<n;i++){
- if(q.s() > max){
- max = q.s();
- }
- if(q.s() == max){
- count++;
- }
- }
- }
- for(int i=0;i<m;i++){
- trap p;
- cin >> a >> b >> c >> d;
- p.set1(a,b,c,d);
- for(int i=0;i<m;i++){
- if(p.s1() > count1){
- count1 = p.s1();
- }
- if(p.s1() < count2){
- count2 = p.s1();
- }
- }
- }
- cout << "Маскимальная площадь четырехугольников: " << max << endl;
- cout << "Количество четырехугольников с макимальной площадью: " << count << endl;
- cout << "Минимальная площадь трапеции: " << count2 << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement