#include <iostream>
#include <cmath>
using namespace std;
int main()
{
float x1, x2, y1, y2;
cout << "Enter x1: ";
cin >> x1;
cout << "Enter y1: ";
cin >> y1;
cout << "Enter x2: ";
cin >> x2;
cout << "Enter y2: ";
cin >> y2;
float d;
float f;
d = sqrt((0 - x1) * (0 - x1) + (0 - y1) * (0 - y1));
f = sqrt((0 - x2) * (0 - x2) + (0 - y2) * (0 - y2));
if (d < f) {
cout << "Point A(" << x1 << ", " << y1 << ") is closer! " << endl;
}
else
cout << "Point B(" << x2 << ", " << y2 << ") is closer! " << endl;
getchar();
getchar();
return 0;
}
Перед публікацією, радимо ознайомиться з правилами!
Знайшли помилку?
Ви можете повідомити про це адміністрацію.
Виділіть текст і натисніть CTRL+Enter