Добавил:
Рад, если кому-то помог Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
0
Добавлен:
01.11.2025
Размер:
875 б
Скачать
#include <iostream>
#include <locale>
using namespace std;

class point {
    int *x, *y, *z;
public:
    point(int c1 = 0, int c2 = 0, int c3 = 0) {
        x = new int(c1);
        y = new int(c2);
        z = new int(c3);
    }
    
    ~point() {
        delete x;
        delete y;
        delete z;
    }
    
    point& operator*=(const point& other) {
        *x *= *other.x;
        *y *= *other.y;
        *z *= *other.z;
        return *this;
    }
    
    void print() const {
        cout << "(" << *x << ", " << *y << ", " << *z << ")" << endl;
    }
};

int main() {
    setlocale(LC_ALL, "ru_RU.UTF-8");
    
    point p1(2, 3, 4);
    point p2(5, 6, 7);
    
    cout << "p1 = "; p1.print();
    cout << "p2 = "; p2.print();
    
    p1 *= p2;
    cout << "После p1 *= p2: "; p1.print();
    
    return 0;
}
Соседние файлы в папке Лаба4