|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;
}
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;
}
|ZZ| C++ 分数类...
|ZZ|..好事..