Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef trylab_class_h
- #define trylab_class_h
- #include "math.h"
- using namespace std;
- const double PI=3.14159265;
- class Nefroida{ //класс Нефроида
- private :
- double a; //радиус
- double alpha; //альфа
- double nx;
- double ny;
- public:
- Nefroida(){//конструктор
- a=0;
- alpha=0;
- nx=0;
- ny=0;
- }
- double geta()const{return a;};
- void seta(double na){
- try{
- if(na>0)
- a=na;
- else
- throw "illegal a";
- }
- catch(const char *p){
- cout<<"Brat za brata"<<endl;
- }
- }
- double getalpha()const{return alpha;};
- void setalpha(double nalpfa){
- alpha=(nalpfa/PI)*180;
- }
- double getnX()const{return nx;}
- double getnY()const{return ny;}
- void setnX(double newx){
- nx=newx;
- }
- void setnY(double newy){
- ny=newy;
- }
- int setXY(){
- double x;
- std::cout<<"Vvedite x = ";//<<std::endl;
- std::cin>>x;
- try{
- if (x!=geta())
- nx=x;
- else
- throw "illegal x";
- }
- catch(const char *p){
- cout<<"Неверное значение x=a"<<endl;
- };
- try{
- if(((a+nx)/(a-nx))>0)
- ny=nx*sqrt((a+nx)/(a-nx));
- else
- throw "illegal sqrt";
- }
- catch(const char *p){
- cout<<"Неверное значение x<a"<<endl;
- }
- return ny;
- }
- double getlength(double alpha){
- double len;
- alpha=(alpha/PI)*180;
- len=-((a*cos(2*alpha))/(cos(alpha)));
- return len;
- }
- /* double getX(double fi){
- double x=3*a*cos(fi)-a*cos(alpha+3*fi);
- return x;
- }*/
- double getX()const{return nx;}
- double getY(){
- double y;
- double x = getX();
- y=(x*sqrt((a+x)/(a-x)));
- return y;
- }
- double getArea(){
- double Area=a*a*(2-PI/2);
- return Area;
- }
- double getArea2(){
- double Area2=a*a*(2+PI/2);
- return Area2;
- }
- double getVolume(){
- double volume=PI*a*a*a*(2*log(2)-(4/3));
- return volume;
- }
- double getcurvate(){
- double curv;
- curv = a*sqrt(2);
- return curv;
- }
- //void form(){
- //}
- };
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement