Untitled

 avatar
unknown
plain_text
a year ago
643 B
3
Indexable

#include <iostream>
using namespace std;

class Area{
    private: int b,c,d;
    float ar,a;
    public: Area(float r){
        a=r;
        ar=3.14*r*r;
    }
    Area(int s){
        b=s;
        ar=s*s*1.0;
    }
    Area(int l, int b){
        c=l;
        d=b;
        ar=c*d*1.0;
    }
    void display(){
        cout<<"Area is: "<<ar<<endl;
    }
};
int main()
{
    int e,f,g,h;
    cout<<"Enter Radius";
    cin>>e;
    cout<<"Enter side";
    cin>>f;
    cout<<"Enter Length and breadth";
    cin>>g>>h;
    Area ob1(e);
    ob1.display();
    Area ob2(f);
    ob2.display();
    Area ob3(g,h);
    ob3.display();
    return 0;
}
Editor is loading...
Leave a Comment