adsense

Hii, welcome to my site. My name is Om prakash kartik. This blog helps you to learn programming languages concepts.

Program in C++ to calculate the area and circumference of circle using Class

Program in C++ to calculate the area and circumference of circle using Class



Without Using Constructor and Destructor
#include<iostream>
#include<conio.h>
 using namespace std;
 class Circle
 {
    private:
     float r;
    public:
     void input()
       {
         cout<<"Enter radius of circle:-";
         cin>>r;
       }
      void Area()
       {
          float a=22.0/7.0*r*r;
          cout<<"\nArea of circle ="<<a;
       }
      void Circumference()
       {
          float p=2*22.0/7.0*r;
          cout<<"\nCircumference of circle ="<<p;
       }
    };
   
   int main()
    {
        Circle c1,c2;
        c1.input();
        c1.Area();
        c1.Circumference();
        return 0;
    }
Output:-









Post a Comment

0 Comments