Advertisement
CosmicFox33

kupil_muzhik_shlyapu_a_ona_emu_kak_raz v2.0

Jan 24th, 2022
1,262
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <math.h>
  3.  
  4. using namespace std;
  5.  
  6. void input(struct circle *c);
  7. void output(struct circle *c);
  8. int sec(struct circle *A, struct circle *B);
  9. int col(struct circle *A, struct circle *B);
  10.  
  11. struct point
  12. {
  13.     float x, y;
  14. };
  15.  
  16. struct circle
  17. {
  18.     point p;
  19.     float rad;
  20.     int color;
  21. };
  22.  
  23. void input(circle *c)
  24. {
  25.     cin >> c->p.x >> c->p.y >> c->rad >> c->color;
  26. }
  27. void output(circle *c)
  28. {
  29.     cout << c->p.x << " " << c->p.y << " " << c->rad << " " << c->color;
  30. }
  31.  
  32. int sec(struct circle *A, struct circle *B)
  33. {
  34.     float H;
  35.     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));
  36.     if(H<(A->rad+B->rad)) return 1;
  37.     return 0;
  38. }
  39. int col(struct circle *A, struct circle *B)
  40. {
  41.     if(A->color==B->color) return 1;
  42.     return 0;
  43. }
  44.  
  45. int main()
  46. {
  47.     int rez, col_m;
  48.     circle a, b;
  49.     input(&a);
  50.     input(&b);
  51.     //output(&C);
  52.     rez=sec(&a, &b);
  53.     col_m=col(&a, &b);
  54.     if(col_m) cout << "Tsvet odinakoviy";
  55.     else cout << "Tsvet ne odinakoviy";
  56.     cout << endl;
  57.     if(rez) cout << "Peresikautsa";
  58.     else cout << "Ne peresikautsa";
  59.  
  60.     return 0;
  61. }
  62.  
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement