some more solves

This commit is contained in:
2025-05-10 16:10:00 +03:00
parent 0cb745c9a1
commit 1924ca48db
11 changed files with 219 additions and 54 deletions
+7 -7
View File
@@ -9,14 +9,14 @@
// };
class Rectangle : Figure {
double a;
double b;
double a = 0;
double b = 0;
public:
Rectangle(double a = 0, double b = 0) : a(a), b(b) {}
double get_square() const {
return a * b;
}
static Rectangle* make(std::string s) {
static Rectangle* make(const std::string& s) {
std::istringstream ss(s);
double a, b;
ss >> a >> b;
@@ -26,13 +26,13 @@ public:
};
class Square : Figure {
double a;
double a = 0;
public:
Square(double a = 0) : a(a) {}
double get_square() const {
return a * a;
}
static Square* make(std::string s) {
static Square* make(const std::string& s) {
std::istringstream ss(s);
double a;
ss >> a;
@@ -42,13 +42,13 @@ public:
};
class Circle : Figure {
double r;
double r = 0;
public:
Circle(double r = 0) : r(r) {}
double get_square() const {
return M_PI * r * r;
}
static Circle* make(std::string s) {
static Circle* make(const std::string& s) {
std::istringstream ss(s);
double r;
ss >> r;