Добавил:
Studfiles2
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:Курсовик по ООП / Kurs3 / ELLIPS
.CPP#include<iostream.h>
#include<math.h>
#include<values.h>
#include<conio.h>
#include "Ellips.h"
//Konstruktor
Ellips::Ellips(double _X,double _Y,int _Lmax,int _Lmin,double _Angle)
{if (_Lmax>0) {Lmax=_Lmax;}
else {cout<<"Dlina doljna bit bolshe 0"<<endl;Lmax=1;}
if (_Lmin>0) {Lmin=_Lmin;}
else {cout<<"Dlina doljna bit bolshe 0"<<endl;Lmin=1;}
X=_X;
Y=_Y;
Angle=_Angle;
}
//Selectori
double Ellips::getX() const
{return X;}
double Ellips::getY() const
{return Y;}
double Ellips::getLmax() const
{return Lmax;}
double Ellips::getLmin() const
{return Lmin;}
double Ellips::getAngle() const
{return Angle;}
double Ellips::getArea() const
{return 3.14*Lmax*Lmin;}
void Ellips::Print() const
{cout<<endl<<"---Orbita Ellips------"<<endl;
cout<<"Nachalnie parametri: "<<endl;
cout<<"X: "<<X<<endl;
cout<<"Y: "<<Y<<endl;
cout<<"Lmax: "<<Lmax<<endl;
cout<<"Lmin: "<<Lmin<<endl;
cout<<"Ugol: "<<Angle<<endl;
cout<<"Area: "<<getArea()<<endl;
cout<<endl;
}
//Modifikatori
void Ellips::setLmax(double _Lmax)
{if (_Lmax>0) {Lmax=_Lmax;}
else {cout<<"Dlina doljna bit bolshe 0"<<endl;}
}
void Ellips::setLmin(double _Lmin)
{if (_Lmin>0) {Lmin=_Lmin;}
else {cout<<"Dlina doljna bit bolshe 0"<<endl;}
}
void Ellips::setAngle(double _Angle)
{Angle=_Angle;}
void Ellips::Revol(double dFi) //Povorot ot osi
{Angle=Angle+dFi;}
void Ellips::Masht(double dN) //Mashtabirovanie
{if (dN>0)
{Lmax=Lmax*abs(dN);
Lmin=Lmin*abs(dN);}
else {cout<<"Dlina doljna bit bolshe 0"<<endl;}
}
void Ellips::Move(double dX,double dY)
{X=X+dX;Y=Y+dY;}