Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- const int N = 3;
- int main() {
- double X[N];
- double Y[N];
- for (int i = 0; i < N; ++i) {
- cout << endl;
- cout << "X: ";
- cin >> X[i];
- cout << endl;
- cout << "Y: ";
- cin >> Y[i];
- }
- int sum = 0;
- int f1 = 0;
- int f2 = 0;
- for (int i = 0; i < N; ++i) {
- for (int j = 0; j < N; ++j) {
- int n = (X[j] - X[i]) + (Y[j] - Y[i]);
- if (i != j && sum < n) {
- sum = n;
- f1 = i + 1;
- f2 = j + 1;
- }
- }
- }
- cout << endl;
- cout << endl;
- cout << "X[";
- cout << f1;
- cout << "]";
- cout << "\tY[";
- cout << f1;
- cout << "]";
- cout << " === ";
- cout << "X[";
- cout << f2;
- cout << "]";
- cout << "\tY[";
- cout << f2;
- cout << "]";
- }
Advertisement
Add Comment
Please, Sign In to add comment