#include
using namespace std;
#define minimum(a, b, c) (((a) < (b)) ? ((a) < (c)) ? (a) : (c) : ((b) < (c)) ? (b) : (c))
struct point {
point() : x(0), y(0), rv(0) { }
point(double _x, double _y) : x(_x), y(_y), rv(sqrt(_x * _x + _y * _y)) { }
double x;
double y;
double rv;
friend bool operator<(const point & _p1, const point & _p2) { return _p1.rv < _p2.rv; }
friend bool operator>(const point & _p1, const point & _p2) { return _p1.rv > _p2.rv; }
};
int main () {
locale::global(locale(""));
const size_t q = 3;
point pt[q];
double x, y;
for (size_t n = 0; n < q; n++) {
cout << " Введите координаты X, Y " << n + 1 << "-й точки: ";
cin >> x >> y;
point temp(x, y);
pt[n] = temp;
}
point min = minimum(pt[0], pt[1], pt[2]);
cout << "\n Ближайшая точка: (" << min.x << "; " << min.y << ')' << endl;
cout << "\n Расстояния точек от центра: \n\n";
for (size_t n = 0; n < q; n++) cout << " (" << pt[n].x << "; " << pt[n].y << "), r = " << pt[n].rv << endl;
cin.get(); cin.get();
return 0;
}