Добавил:
Studfiles2
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:Лабораторная работа 12 / LAB1_CONSOLE - final / Pentagon
.cpp// Copyright (C) 1991 - 1999 Rational Software Corporation
#include "Pentagon.h"
#include <iostream.h>
#include <math.h>
#define PI 3.1415926535897932384626433832795
//##ModelId=47092D650177
Pentagon::Pentagon(double centerX, double centerY, double size):
ID(++count_ID)
{
// TODO: Add your specialized code here.
this->centerX = centerX;
this->centerY = centerY;
this->size=size;
cout << "Counstuctor: Pentagon object ID: " << ID << " ( " << centerX << " , " << centerY << " ) size: " << size << endl;
}
//##ModelId=470A152E01C5
Pentagon::~Pentagon()
{
// TODO: Add your specialized code here.
cout << "Destructor: Pentagon object ID: " << ID << endl;
}
//##ModelId=472F355503A9
double Pentagon::area() {
return 5*size*size*sin(2*PI/10)*sin(3*PI/10);
}
//##ModelId=472F355503D8
void Pentagon::moveTo(double newX, double newY) {
this->centerX = newX;
this->centerY = newY;
}
//##ModelId=470A2862001F
long Pentagon::count_ID = 0;
//##ModelId=470A27EF034B
void Pentagon::draw()
{
// TODO: Add your specialized code here.
cout <<"Pentagon::draw() " << " ( " << centerX << " , " << centerY << " ) size: " << size << endl;
}
void Pentagon::writeIn(ostream& o) const
{
o << *this;
}
Соседние файлы в папке LAB1_CONSOLE - final