Advertisement
Guest User

Untitled

a guest
Apr 2nd, 2021
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. #include <windows.h>
  2. #include <iostream>
  3. #include <iomanip>
  4. #include <string>
  5.  
  6. using namespace std;
  7. ////////////////////////
  8. void RusText(void);
  9.  
  10. class PointRadio
  11. {
  12. public:
  13. double x;
  14. double y;
  15.  
  16. double x0;
  17. double y0;
  18. double r0;
  19.  
  20. int Res;
  21.  
  22. PointRadio(double xx, double yy, double xx0, double yy0, double rr0)
  23. {
  24. x= xx; y= yy; x0= xx0; y0= yy0; r0= rr0;
  25. }
  26.  
  27. void OutResult()
  28. {
  29. double g= (x-x0)*(x-x0)+(y-y0)*(y-y0); double r= r0*r0;
  30. if (r==g) Res=0;
  31. if (r<g) Res=-1;
  32. if (r>g) Res=1;
  33.  
  34. cout<<"Точка x,y ("<<x<<","<<y<<")"<<endl;
  35. cout<<"Окружность x0,y0 ("<<x0<<","<<y0<<") и радиус r0= "<<r0<<endl;
  36.  
  37. switch(Res)
  38. {
  39. case 0: cout<<"НА ГРАНИЦЕ окружности"<<endl;
  40. break;
  41. case 1: cout<<"ВНУТРИ окружности"<<endl;
  42. break;
  43. default:cout<<"ВНЕ окружности"<<endl;
  44. break;
  45. }
  46. }
  47.  
  48. };
  49. ////////////////////////////////////////////////
  50. int main(int argc, char **argv)
  51. {
  52.  
  53. RusText();
  54.  
  55. PointRadio prIn(5,5,0,0,10); prIn.OutResult(); cout<<endl;
  56. PointRadio prBr(10,0,0,0,10); prBr.OutResult(); cout<<endl;
  57. PointRadio prOut(25,25,0,0,10); prOut.OutResult(); cout<<endl;
  58.  
  59. cout<<endl; system("pause");
  60. return 0;
  61. }
  62.  
  63. ////////// Руссификация сообщений //////////////////////////////////
  64.  
  65. void RusText(void)
  66. {
  67. system("chcp 1251 > nul");
  68. SetConsoleTitle(TEXT("ОтветыМейлРу")); //Для совместимости с VS
  69. return;
  70. }
  71.  
  72.  
  73.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement