Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- using namespace std;
- int main()
- {
- struct toado
- {
- double x;
- double y;
- };
- toado h[5];
- double kc(0);
- int i, j, a, b;
- for (i = 0; i < 5; i++)
- {
- cout << "Nhap toa do diem thu " << i+1 << endl;
- cout << "x = "; cin >> h[i].x; cout << "y = "; cin >> h[i].y;
- }
- for (i = 0; i < 5; i++)
- {
- for (j = i + 1; j < 5; j++)
- {
- if (kc < sqrt(pow(h[i].x - h[j].x, 2) + pow(h[i].y - h[j].y, 2)))
- {
- kc = sqrt(pow(h[i].x - h[j].x, 2) + pow(h[i].y - h[j].y, 2));
- a = i+1; b = j+1;
- }
- }
- }
- cout << a << " " << b << endl;
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement