Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <math.h>
- #include <stdio.h>
- #include <stdlib.h>
- #define pi 3.14
- struct Coords
- {
- float a;
- float r;
- float x;
- float y;
- };
- int main()
- {
- Coords Coordinats[100], *pointer;
- pointer = &Coordinats[0];
- printf("Введите количество точек\n");
- unsigned int n;
- scanf("%u", &n);
- for (unsigned int i = 0; i < n; i++)
- {
- scanf("%f", &pointer->a);
- scanf("%f", &pointer->r);
- pointer->x = pointer->r * cos(pointer->a);
- pointer->y = pointer->r * sin(pointer->a);
- printf("%f %f\n", pointer->x, pointer->y);
- pointer++;
- }
- pointer = &Coordinats[0];
- float xmax = pointer->x, ymax = pointer->y, xmin = pointer->x, ymin = pointer->y;
- for (size_t i = 0; i < n; i++)
- {
- if (xmax < pointer->x)
- xmax = pointer->x;
- if (xmin > pointer->x)
- xmin = pointer->x;
- if (ymax < pointer->y)
- ymax = pointer->y;
- if (ymin > pointer->y)
- ymin = pointer->y;
- pointer++;
- }
- printf("Левый верхний угол - %f,%f\n Левый нижний угол - %f,%f\n Правый верхний угол - %f,%f\n Правый нижний угол - %f,%f\n", xmin, ymax, xmin, ymin, xmax, ymax, xmax, ymin);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement