Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- #define PI 3.14159265
- class circle
- {
- private:
- double xcentar,ycentar,r;
- public:
- circle();
- circle(double);
- circle(double,double,double);
- void area();
- void perimeter();
- void ox();
- void oy();
- };
- circle::circle()
- {
- xcentar=0;
- ycentar=0;
- r=100;
- }
- circle::circle(double x)
- {
- xcentar=0;
- ycentar=0;
- r=x;
- }
- circle::circle(double a,double b, double x)
- {
- xcentar=a;
- ycentar=b;
- r=x;
- }
- void circle::area()
- {
- double S = PI*r*r;
- cout << "Liceto na kruga e -> " << S << endl;
- }
- void circle::perimeter()
- {
- double P = 2*PI*r;
- cout << "Perimetura na kruga e -> " << P << endl;
- }
- void circle::ox()
- {
- double a,t1,t2;
- a = sqrt(r*r-ycentar*ycentar);
- t1=xcentar-1;
- t2=xcentar-1;
- cout << "(" << t1 << ";" << 0 << ")" << endl;
- cout << "(" << t2 << ";" << 0 << ")" << endl;
- }
- void circle::oy()
- {
- double a,t1,t2;
- a = sqrt(r*r-xcentar*xcentar);
- t1=y-1;
- t2=y-1;
- cout << "(" << t1 << ";" << 0 << ")" << endl;
- cout << "(" << t2 << ";" << 0 << ")" << endl;
- }
- int main ()
- {
- double x,y,radius;
- cout << "Vavedi centar i radius -> " << endl;
- cin >> x >> y >> radius;
- circle num1(x,y,radius);
- num1.area();
- cout << endl;
- num1.perimeter();
- cout << endl;
- num1.ox();
- cout << endl;
- num1.oy();
- cout << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement