Dimitar23308

okrujnosti

Feb 20th, 2026 (edited)
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.88 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3.  
  4. using namespace std;
  5.  
  6.  
  7. struct Circle {
  8.     double x, y, r;
  9. };
  10.  
  11. int main() {
  12.     Circle c1, c2;
  13.  
  14.     cout << "Vavedi x, y, r za pуrvata: ";
  15.     cin >> c1.x >> c1.y >> c1.r;
  16.  
  17.     cout << "Vavedi x, y, r za vtorata: ";
  18.     cin >> c2.x >> c2.y >> c2.r;
  19.  
  20.     double d = sqrt(pow(c2.x - c1.x, 2) + pow(c2.y - c1.y, 2));
  21.  
  22.    
  23.     double sumR = c1.r + c2.r;
  24.     double diffR = abs(c1.r - c2.r);
  25.  
  26.    
  27.     if (d == 0) {
  28.         cout << "Koncentrichni" << endl;
  29.     } else if (d > sumR) {
  30.         cout << "Vanshani (ne se dopirat)" << endl;
  31.     } else if (d == sumR) {
  32.         cout << "Dopirashti se vanshno" << endl;
  33.     } else if (d == diffR) {
  34.         cout << "Dopirashti se vatreshno" << endl;
  35.     } else if (d < diffR) {
  36.         cout << "Vatreshni" << endl;
  37.     } else {
  38.         cout << "Sekushti" << endl;
  39.     }
  40.  
  41.     return 0;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment