Mira2706

hw1_1

Nov 18th, 2019
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.76 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     //task 1
  9.  
  10.  
  11.     int circle_X1 = -2;
  12.     int circle_Y1 = 0;
  13.     int circle_X2 = 1;
  14.     int circle_Y2 = 1;
  15.     int point_X, point_Y;
  16.     int r1 = 2;
  17.     double r2 = sqrt(5);
  18.  
  19.  
  20.     cout<<"Define the coordinates of the point: ";
  21.     cin>>point_X>>point_Y;
  22.  
  23.     if (abs(point_X - circle_X1) <=r1 && abs(point_Y - circle_Y1)<=r1)
  24.     {
  25.         cout<<"The point lies within circle 1."<<endl;
  26.     }
  27.  
  28.     else if (abs(point_X - circle_X2) <=r2 && abs(point_Y - circle_Y2)<=r2)
  29.     {
  30.         cout<<"The point lies within circle 2."<<endl;
  31.     }
  32.  
  33.     else
  34.     {
  35.         cout<<"The point is located beyond the surface of both circles."<<endl;
  36.     }
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.     return 0;
  45. }
Advertisement
Add Comment
Please, Sign In to add comment