为何总说有错误,
#include<iostream.h>
class Rectangle{
private:
typedef float LengthType;
typedef float AreaType;
LengthType width,height;
public:
void SetWidth(LengthType newWidth);
void SetHeight(LengthType newHeight);
AreaType Area();
LengthType Perimeter();
};
void Rectangle::SetWidth(LengthType newWidth)
{
width=newWidth;
}
void Rectangle::SetHeight(LengthType newHeight)
{
height=newHeight;
}
Rectangle::AreaType Rectangle::Area()
{
return heigth*width;
}
Rectangle::LengthType::Rectangle::Perimeter()
{
return 2*(width+height);
}
void main()
{
Rectangle rect;
rect.SetWidth(45);
rect.SetHeight(54.2);
cout<<"The area of rectangle is"<<rect.Area()<<endl;
cout<<"The perimeter of rectangle is"<<rect.Perimeter()<<endl;
}
请问如何初始化呢,可否写出;
答案可否详细一点.
本人还是C++的自学者,还有部分知识还未掌握,我试过添加了还不能,这就是整个程序了