Advertisement
TheMagnusRex

Peresechenie_krugov

Oct 19th, 2016
114
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. using namespace std;
  4. int main()
  5. {
  6.     float r1,r2,R12,L21;
  7.     float x1,x2,y1,y2;
  8.     cout<<"r1=";
  9.     cin>>r1;
  10.     cout<<"x1=";
  11.     cin>>x1;
  12.     cout<<"y1=";
  13.     cin>>y1;
  14.     cout<<"r2=";
  15.     cin>>r2;
  16.     cout<<"x2=";
  17.     cin>>x2;
  18.     cout<<"y2=";
  19.     cin>>y2;
  20.     L21=r2+r1;
  21.     R12=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
  22.     if(r2==r1){
  23.         if(R12==0||R12<=L21){
  24.             cout<<"peresekayutsa";
  25.         }
  26.         else{
  27.             cout<<"ne peresekayutsa";
  28.         }
  29.     }
  30.     if(r2>r1){
  31.         if(R12<=L21&&(r1+R12>=r2)){
  32.             cout<<"peresekayutsa";
  33.         }
  34.         else{
  35.             cout<<"ne peresekayutsa";
  36.         }
  37.     }
  38.     if(r1>r2){
  39.         if(R12<=L21&&(r2+R12>=r1)){
  40.             cout<<"peresekayutsa";
  41.         }
  42.         else{
  43.             cout<<"ne peresekayutsa";
  44.         }
  45.         }
  46.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement