python输入长和宽输出面积_请用C++编写 从键盘上输入长方形的长和宽,输出周长和面积...

满意答案

t011655040b3ed000bf.jpg

cd12008

2015.05.22

t011655040b3ed000bf.jpg

采纳率:41% 等级:9

已帮助:462人

#include

using namespace std;

class Rectangle

{

double length;

double width;

public:

Rectangle(double m_length,double m_width)

{

this->length=m_length;

this->width=m_width;

}

double peri()

{

return 2*length+2*width;

}

double area()

{

return length*width;

}

void show()

{

cout<<"周长:"

}

};

int main()

{

double len;

double wid;

cout<<"请输入长方形的长和宽:"<

cout<<"长:";

cin>>len;

cout<<"宽:";

cin>>wid;

Rectangle rec(len,wid);

rec.show();

return 0;

}

05分享举报

你可能感兴趣的:(python输入长和宽输出面积)