#include <iostream>
using namespace std;
class Area
{
public:
int getArea(int l,int h);
};
int Area::getArea(int l,int h)
{
return l*h;
}
class Perimeter
{
public:
int getPerimeter(int x,int y)
{
return 2*(x+y);
}
};
class Rectangle : public Area, public Perimeter
{
};
int main() {
int l,b;
Rectangle rt;
cin>>l>>b;
cout<<rt.getArea(l,b)<<endl;
cout<<rt.getPerimeter(l,b);
return 0;
}
using namespace std;
class Area
{
public:
int getArea(int l,int h);
};
int Area::getArea(int l,int h)
{
return l*h;
}
class Perimeter
{
public:
int getPerimeter(int x,int y)
{
return 2*(x+y);
}
};
class Rectangle : public Area, public Perimeter
{
};
int main() {
int l,b;
Rectangle rt;
cin>>l>>b;
cout<<rt.getArea(l,b)<<endl;
cout<<rt.getPerimeter(l,b);
return 0;
}
#include
ReplyDeleteusing namespace std;
class Area
{
public:
int getArea(int length, int berth)
{
return length*berth;
}
};
class Perimeter
{
public:
int getPerimeter(int length, int berth)
{
return length+length+berth+berth;
}
};
class Rectangle:public Area,public Perimeter
{
};
int main() {
Rectangle rt;
int l,b;
cin>>l>>b;
cout<<rt.getArea(l,b)<<endl;
cout<<rt.getPerimeter(l,b)<<endl;
return 0;
}
0% result
ReplyDelete#include
ReplyDeleteusing namespace std;
class Area
{
public:
int getArea(int length, int berth)
{
return length*berth;
}
};
class Perimeter
{
public:
int getPerimeter(int length, int berth)
{
return length+length+berth+berth;
}
};
class Rectangle:public Area,public Perimeter
{
};
int main() {
Rectangle rt;
int l,b;
cin>>l>>b;
cout<<rt.getArea(l,b)<<endl;
cout<<rt.getPerimeter(l,b)<<endl;
return 0;
}
Works! thanks bruv
Delete