Загрузка данных


#include <iostream>
#include <windows.h>

using namespace std;

class rectangle
{
private:
    double length;
    double width;

public:
    rectangle();
    rectangle(double Len, double Wide);

    double Length();
    double Width();
    double Area();

    void assign(double Len, double Wide);
};

rectangle::rectangle()
{
    assign(0, 0);
}

rectangle::rectangle(double Len, double Wide)
{
    assign(Len, Wide);
}

double rectangle::Length()
{
    return length;
}

double rectangle::Width()
{
    return width;
}

double rectangle::Area()
{
    return length * width;
}

void rectangle::assign(double Len, double Wide)
{
    length = Len;
    width = Wide;
}

int main()
{
    SetConsoleCP(1251);
    SetConsoleOutputCP(1251);

    rectangle rect;
    double len, wide;

    cout << "Введите длину прямоугольника : ";
    cin >> len;

    cout << "Введите ширину прямоугольника : ";
    cin >> wide;

    rect.assign(len, wide);

    cout << "Параметры прямоугольника : " << endl;
    cout << "длина = " << rect.Length() << endl;
    cout << "ширина = " << rect.Width() << endl;
    cout << "площадь = " << rect.Area() << endl;

    system("pause");
    return 0;
}