lintcode-矩阵面积

来源:互联网 发布:东盟水果进口贸易数据 编辑:程序博客网 时间:2024/06/09 19:49

今天刷了lintcode-矩阵面积的题目,大概是练习构造函数,代码在VS上通过了,但是在lintcode运行,一直显示测试中。

总之,先把代码放在这里吧.

#includeusing namespace std;class Rectangle{ public:    Rectangle(int,int); int width,height;    int getArea();   }; Rectangle::Rectangle(int w,int h) {     width=w;     height=h; }   int Rectangle::getArea()  {      return(width*height);  }  void main()  {  int i,j;  cin>>i;  cin>>j;  Rectangle test(i,j);  cout<<"面积的大小为"<