Advertisement
Guest User

Groz

a guest
Feb 23rd, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3.  
  4. using namespace std;
  5.  
  6. #define PI 3.14159265
  7.  
  8. class circle
  9. {
  10. private:
  11. double xcentar,ycentar,r;
  12. public:
  13. circle();
  14. circle(double);
  15. circle(double,double,double);
  16. void area();
  17. void perimeter();
  18. void ox();
  19. void oy();
  20. };
  21. circle::circle()
  22. {
  23. xcentar=0;
  24. ycentar=0;
  25. r=100;
  26. }
  27. circle::circle(double x)
  28. {
  29. xcentar=0;
  30. ycentar=0;
  31. r=x;
  32. }
  33. circle::circle(double a,double b, double x)
  34. {
  35. xcentar=a;
  36. ycentar=b;
  37. r=x;
  38. }
  39. void circle::area()
  40. {
  41. double S = PI*r*r;
  42. cout << "Liceto na kruga e -> " << S << endl;
  43. }
  44. void circle::perimeter()
  45. {
  46. double P = 2*PI*r;
  47. cout << "Perimetura na kruga e -> " << P << endl;
  48. }
  49. void circle::ox()
  50. {
  51. double p1, p2;
  52. p1=xcentar+sqrt(r*r-ycentar*ycentar);
  53. p2=xcentar-sqrt(r*r-ycentar*ycentar);
  54. cout << p1 << " " << p2 << endl;
  55. }
  56. void circle::oy()
  57. {
  58. double q1,q2;
  59. q1=ycentar+sqrt(r*r-xcentar*xcentar);
  60. q2=ycentar-sqrt(r*r-xcentar*xcentar);
  61. cout << q1 << " " << q2 << endl;
  62. }
  63. int main ()
  64. {
  65. double x,y,radius;
  66. cout << "Vavedi centar i radius -> " << endl;
  67. cin >> x >> y >> radius;
  68. circle num1(x,y,radius);
  69. num1.area();
  70. cout << endl;
  71. num1.perimeter();
  72. cout << endl;
  73. num1.ox();
  74. cout << endl;
  75. num1.oy();
  76. cout << endl;
  77. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement