#include "pch.h"
#include <iostream>

using namespace std;

struct Point //структура (почти класс)
{
	double x; //поле
	double y;

	Point()
	{
	}

	Point(double xx, double yy = 5) //конструктор
		: x(xx), y(yy)
	{
		if (x < 0)
			x = 0;
		if (y < 0)
			y = 0;
	}

	double dist() //метод
	{
		return sqrt(x * x + y * y);
	}

	double scl(Point other)
	{
		return x * other.x + y * other.y;
	}
};

int main()
{
	Point p(4.2, 5.3); // экземпляр структуры (объект)
	
	Point p(3.9);
	
	Point p2;
	p2.x = 3.5;
	p2.y = p.x;

	cout << p.dist() << endl;
	cout << p.scl(p2) << endl;
}

