#include <iostream>
#include <cmath>
#include <fstream>
#include <regex>
#include <exception>
class Regular_Pyramid
{
protected:
std::string name;
double side;
double height;
double total_area = 1.0;
public:
static int ostroslupy_duze;
Regular_Pyramid()
{
name = "Pyramid";
side = 1;
height = 1;
}
Regular_Pyramid(std::string name, double side, double height)
{
this->name = name;
this->side = side;
this->height = height;
}
~Regular_Pyramid() = default;
virtual void calculate_area()
{
/*double triangle_height;
triangle_height = sqrt(height*height + 0.25 * side * side);
total_area = side * side + 4 * triangle_height * 0.5 * side;
std::cout << "Pole powierzchni ostroslupa " << name << " jest rowne: " << total_area << std::endl;*/
}
};
class Square_Regular_Pyramid : public Regular_Pyramid
{
public:
void calculate_area() override
{
/*double triangle_height;
triangle_height = sqrt(height*height + 0.25 * side * side);
total_area = side * side + 4 * triangle_height * 0.5 * side;
std::cout << "Pole powierzchni ostroslupa " << name << " jest rowne: " << total_area << std::endl;*/
total_area = 2 * side * sqrt(height * height + 0.25 * side * side) + side * side;
}
void operator-(int b)
{
try
{
if(side <= 0) throw "Nie mozna zmiejszyc o podana dlugosc";
side = side - b;
}
catch(const char* e)
{
std::cout << e << std::endl;
}
}
};
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}