Главная » 2017 » Ноябрь » 26 » классы
19:41
классы

#include "math.h"
#include <iostream>
using namespace std;
class vector { 
    double x1, x2, y1, y2, xs, ys;
public:
    vector(double a, double b, double c, double d); 
    ~vector(); 
    void seredin();
    double ugol();
};
vector::vector(double a, double b, double c, double d) 
{
    x1 = a; y1 = b; x2 = c; y2 = d;
}
vector::~vector()
{
    cout << "12345"<<endl;
}
void vector::seredin() 
{
    xs=(x1+x2)/2;
    ys=(y1+y2)/2;
    cout<<"Xs="<<xs<<" Ys="<<ys<<endl;
}
double vector::ugol() 
{
    return (y2-y1)/(x2-x1);
}
int main()
{
    double aa,bb,cc,dd;
    cin>>aa>>bb>>cc>>dd;
    vector a=vector(aa,bb,cc,dd);
    vector b=vector(13,22,3,44);
    a.seredin();
    cout<<"tg(a)="<<a.ugol()<<endl;
    b.seredin();
    cout<<"tg(b)="<<b.ugol()<<endl;
    system("pause"); 
    return 0;
}

Просмотров: 312 | Добавил: denjes | Рейтинг: 0.0/0
Всего комментариев: 0
avatar