全文预览

C课后习题参考答案

上传者:梦&殇 |  格式:pdf  |  页数:68 |  大小:6728KB

文档介绍
square::area()\r{\rcoutnthe internal square's area is";\rcout2*r*rendl;\r}\rvoid in_square: :perimeter()\r{\rcout"The internal square's perimeter is";\rcout4*l.l 414*rendl;\r)\rclass ex_square:public shape\r(\rpublic:\rex_square(double x);\rvoid area();\rvoid peri meter();\r);\rex_square: :ex_square(double x):shape(x)\r1)\rvoid ex_square::area()\r(\rcoutnThe external square's area is";\rcout4 *r*rendl;\r}\rvoid ex_square::perimeter()\r(\rcout"the external square's perimeter is";\rcoutv v8 *rendl;.\rvoid main()\r(\rshape *ptr;\rcircle obl(5);\rin_square ob2(5);\rex_square ob3(5);\rptr=&obl;\rptr->area();\rptr-> peri met er();\rptr=&ob2;\rptr->area();\rptr->perimeter();\rptr=&ob3;\rptr->area();\rptr->perimeter();

收藏

分享

举报
下载此文档