C语言程序设计现代方法第16章答案(2)

2021-02-21 12:24

return c;

}

(d)

Complex add_complex(Complex c1, Complex c2)

{

Complex c3;

c3.real = c1.real + c2.real;

c3.imaginary = c1.imaginary + c2.imaginary;

return c3;

}

11. [was #10; modified] The a member will occupy 8 bytes, the union e will take 8 bytes (the largest member, c, is 8 bytes long), and the array f will require 4 bytes, so the total space allocated for s will be 20 bytes.

14. [was #12; modified]

(a)

double area(struct shape s)

{

if (s.shape_kind == RECTANGLE)

return s.u.rectangle.height * s.u.rectangle.width;

else

return 3.14159 * s.u.circle.radius * s.u.circle.radius; }

(b)

struct shape move(struct shape s, int x, int y)

{

struct shape new_shape = s;

new_shape.center.x += x;

new_shape.center.y += y;

return new_shape;

}

(c)


C语言程序设计现代方法第16章答案(2).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:毛泽东思想和中国特色社会主义理论体系概论课后习题答案

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: