Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- typedef struct
- {
- float x, y;
- } PUNCT;
- int main()
- {
- float maxi = 0.0;
- PUNCT p[100];
- int n, papx = 0;
- cin >> n;
- for (int i = 0; i < n; i++)
- cin >> p[i].x >> p[i].y;
- for (int i = 0; i < n; i++)
- if (!p[i].y)
- papx++;
- cout << "apartin lui Ox: " << papx << endl;
- for (int i = 0; i < n; i++)
- for (int j = 0; j < n; j++)
- if (i != j)
- {
- float d = sqrt((p[i].x - p[j].x) * (p[i].x - p[j].x) + (p[i].y - p[j].y) * (p[i].y - p[j].y));
- if (maxi < d)
- maxi = d;
- }
- cout << "distanta maxima: " << maxi;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement