|ZZ|c++ .长方形类.方法2.P91.  3.32

May 14, 2007 13:46

ZZ谢谢..一些人的帮忙.....相当感谢...

面向对象程序设计与c++语言(第2版)
P91.  3.32

#include<iostream.h>
class Rectangle
{
   int c,k;
   public:
  int GetArea()
  {
      return c*k;
  }
  int GetCh()
  {
      return 2*(c+k);
  }
  Rectangle (int a,int b):c(a),k(b)
{
}
};
void main()
{
   Rectangle f(4,5);
   cout<<f.GetArea()<<endl;
   cout<<f.GetCh()<<endl;
}

Tags:

Category: c++的某些作业阅读(1317) 评论(0)

昵称   密码   游客无需密码
网址   电邮   [注册]

 

最新日志

最新评论

最新留言

随机日志

养家糊口

酷站链接

魔域私服
传奇私服
魔域私服网

其他

登入
注册
申请链接
RSS: 日志 | 评论
编码:UTF-8
XHTML 1.0