第1 章 参考答案 一、 选择题 1.C 2.B 3.C 4.A 5.C 6.A 7.C 8 C 9A 10 C 二、阅读题 1.x=2,y=3 2.x=2,y=3 x!=y 3. Cstatic::va1=0 cs1.vaI=1 cs2.val=2 cs1.val=4 cs2.vaI=4 四、改错题 #include #include class person { public: person(int n,char* nam,char s) { num=n; strcpy(name,nam); sex=s; cout<<"Constructor called."< using namespace std; class CBox { public : CBox(double l=0,double w=0,double h=0); double area(); double volume (); private : double lengh; double width; double high; }; CBox::CBox(double l,double w,double h) { lengh=l; width=w; high=h; } double CBox::area() { return 2*(lengh*width+lengh*high+width*high); } double CBox::volume () { return lengh*width*high; } void main() { CBox box1(4,5,6); cout< using namespace std; class CPoint { public : CPoint(double a=0,double b=0) { x=a; y=b; } CPoint(CPoint & p) { x=p.x; y=p.y; } void print() { cout<<"("<