Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void closestToTheCenter(double x1, double x2, double y1, double y2) {
- if (abs(x1 * x1 + y1 * y1) < abs(x2 * x2 + y2 * y2)) {
- cout << "(" << x1 << ", " << y1 << ")\n";
- }
- else {
- cout << "(" << x2 << ", " << y2 << ")\n";
- }
- }
- int main() {
- double x1, y1, x2, y2;
- cin >> x1 >> y1 >> x2 >> y2;
- closestToTheCenter(x1, x2, y1, y2);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement