troubleshooting Question

Circle class

Avatar of deep patel
deep patel asked on
C++
3 Comments3 Solutions201 ViewsLast Modified:
i did my program but i m getting many error  in my program. errors like unexpected token ":" or ";" before double and this is my program.

 
#include<iostream>


 using namespace std;

 class Circle
 {
    private
    double PI = 3.14159;
    double radius;

    public Circle()
    {
        radius = 0.0;
    }

    public Circle(double r)
    {
        radius = r;
    }

    public void setRadius(double r)
    {
        radius = r;
    }

    public double getRadius()
    {
        return radius;
    }

    public double getArea()
    {
        return PI * radius * radius;
    }

    public double getDiameter()
    {
        return radius * 2;
    }

    public double getCircumference()
    {
        return 2 * PI * radius;
    }
 };


int main()
 {
     double radius;

     cout << "Enter the circle's radius:" << endl;
     cin >> radius;

     cout << "Radius:" << c.getRadius() << endl;

     cout << "Area:" << c.getArea() << endl;

     cout << "Diameter:" << c.getDiameter() << endl;

     cout << "Circumference:" << c.getCircumference() << endl;

     return 0;
 }
ASKER CERTIFIED SOLUTION
phoffricSoftware Engineering and Matlab Analyst

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 3 Answers and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 3 Answers and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros