【问题描述】编写一个矩形rectangle类,有数据成员长len和宽wid,构造函数rectangle(int,int).和友元函数int area(rectangle T)和int fun(rectangle T) 分别计算给定长方形的周长和面积。
【输入形式】数据成员由构造函数初始化
【输出形式】长方形的周长和面积
【样例输入】无输入,如设置对象rectangle r1(3,4);
【样例输出】按照上面的构造函数输入,则输出:the perimeter is 14,the area is 12
//计算长方形的周长和面积 #includeusing namespace std; class rectangle { private: int len,wid; public: rectangle(int a,int b); friend int area(rectangle r1);//友元函数面积 friend int fun(rectangle r1);//友元函数周长 }; rectangle::rectangle(int a,int b)//构造函数 { len=a; wid=b; } int area(rectangle r1) { return r1.len*r1.wid; } int fun(rectangle r1) { return 2*(r1.len+r1.wid); } int main() { rectangle r1(3,4); cout<<"the perimeter is "<



