Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
643 B
1
Indexable
Never

#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;
}
Leave a Comment