#include
using namespace std;
class TRetargle
{
public:
float Setdate();
void perim(float x,float y);
void area(float x ,float y);
void squire(float x,float y);
private:
float z,m;
};
float TRetargle::Setdate()
{
float s;
cin >> s;
return s;
}
void TRetargle::perim(float x,float y)
{
z=(x+y)*2;
cout << "the perim is "<< z <
}
void TRetargle::area(float x,float y)
{
m=x*y;
cout << "the area is "<< m <
}
void TRetargle::squire(float x,float y)
{
if(x==y)
cout << "This is a squire" <else
cout << "This is not a squire"<}
int main()
{
float a,b;
TRetargle p1,p2,p3,p4,p5;
cout << "please input length"<cout << "please input Width"< a=p1.Setdate();
b=p2.Setdate();
p3.perim(a,b);
p4.area(a,b);
p5.squire(a,b);
cout << "Hello world!" << endl;
return 0;
}
这个不是要判断,是要你事先规定。
你在写函数定义的时候必须定义好一个函数的输入输入有哪些分别是什么类型。