Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- using namespace std;
- void input(struct circle *c);
- void output(struct circle *c);
- int sec(struct circle *A, struct circle *B);
- int col(struct circle *A, struct circle *B);
- struct point
- {
- float x, y;
- };
- struct circle
- {
- point p;
- float rad;
- int color;
- };
- void input(circle *c)
- {
- cin >> c->p.x >> c->p.y >> c->rad >> c->color;
- }
- void output(circle *c)
- {
- cout << c->p.x << " " << c->p.y << " " << c->rad << " " << c->color;
- }
- int sec(struct circle *A, struct circle *B)
- {
- float H;
- H=sqrt((A->p.x-B->p.x)*(A->p.x-B->p.x)+(A->p.y-B->p.y)*(A->p.y-B->p.y));
- if(H<(A->rad+B->rad)) return 1;
- return 0;
- }
- int col(struct circle *A, struct circle *B)
- {
- if(A->color==B->color) return 1;
- return 0;
- }
- int main()
- {
- int rez, col_m;
- circle a, b;
- input(&a);
- input(&b);
- //output(&C);
- rez=sec(&a, &b);
- col_m=col(&a, &b);
- if(col_m) cout << "Tsvet odinakoviy";
- else cout << "Tsvet ne odinakoviy";
- cout << endl;
- if(rez) cout << "Peresikautsa";
- else cout << "Ne peresikautsa";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement