Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main()
- {
- float r1,r2,R12,L21;
- float x1,x2,y1,y2;
- cout<<"r1=";
- cin>>r1;
- cout<<"x1=";
- cin>>x1;
- cout<<"y1=";
- cin>>y1;
- cout<<"r2=";
- cin>>r2;
- cout<<"x2=";
- cin>>x2;
- cout<<"y2=";
- cin>>y2;
- L21=r2+r1;
- R12=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
- if(r2==r1){
- if(R12==0||R12<=L21){
- cout<<"peresekayutsa";
- }
- else{
- cout<<"ne peresekayutsa";
- }
- }
- if(r2>r1){
- if(R12<=L21&&(r1+R12>=r2)){
- cout<<"peresekayutsa";
- }
- else{
- cout<<"ne peresekayutsa";
- }
- }
- if(r1>r2){
- if(R12<=L21&&(r2+R12>=r1)){
- cout<<"peresekayutsa";
- }
- else{
- cout<<"ne peresekayutsa";
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement