C期末考试试题及答案9.docxVIP

  • 2
  • 0
  • 约1.07万字
  • 约 50页
  • 2021-11-10 发布于山东
  • 举报
C期末考试试题及答案9 C期末考试试题及答案9 C期末考试试题及答案9 2002 年春天软件学院 C++ 期末考试一试卷及答案 考试时间: 120 分钟 1. (10) 分 现有两种实体:“矩形”(Rectangle )和“旗杆” Flagpole )。此中,“矩形”的属性为长度与宽度,“旗杆”的属性为高度(指地面以上)和深度(指地面以下),且均为 整数。如有: struct Rectangle { int length, width 。}。 struct Flagpole { int height, depth 。}。 int rectangleArea (int x, int y) {return (x=0 y=0)?x*y:0 。} //计算矩形的面积 1/79 int flagpoleLength (int x, int y) {return (x=0 y=0)?x+y:0 。} 计算旗杆的高度 void f() { struct Rectangle rect 。 struct Flagpole flgp 。 rect.length=20 。 rect.width=5 。 flgp.height=20 。 flgp.depth=5 。 int area=rectangleArea(rect.length, rect.width) 。 int length=flagp

文档评论(0)

1亿VIP精品文档

相关文档