C++实验报告(5)
学生实验报告

一、实验综述
1、实验目的及要求
完成以下上机题目
1. Given a Rectangle class, which has Width and Height attributes and the following behaviors:
(1) Init(): to initialize the Width and Height
(2) SetWidth(): to set Width
(3) SetHeight(): to set Height
(4) GetWidth(): to get Width
(5) GetHeight(): to get Height
(6) Area(): to calculate the area of the rectangle
(7) DispInfo(): to show the information of the rectangle such as Width, Height and area.
Please analyze and design the class based on the above requirements.
2. Design a class Circle, which can be used to calculate the area and circumference of a circle. The radius is set when initializing an object. Please give a main function to call the class.
3. Design a Rectangle class with two attributes, Width and Height and to satisfy the following requirements. When the object is initialized by two arguments, which represent Width and Height respectively. But, when the object is initialized by only one argument, which means the rectangle is a square. There is a member function to show the area of the Rectangle in the class. Please also give a main function to call the class.
2、实验仪器、设备或软件
实验所用仪器:电脑
实验所用软件:visual c++ 6.0
二、实验过程(实验步骤、记录、数据、分析)
1. 定义一个长方形Rectangle类,它有宽、高(Width,Height)和一些计算方法:
(1) Init():设定宽、高的初始值
(2) SetWidth():设定宽度
你可能喜欢
- 化学实验报告
- 物理实验报告
- 网上书店实验报告
- 会计模拟实验报告
- erp实验报告
- c语言实验报告
- 编译原理实验报告
- spss实验报告
- 九年级化学分组实验报告单8页
- 有机化学实验报告格式2页
- 化学实验报告1页
- 化学实验报告14页
- 如何编写化学实验报告2页
- 化学实验报告1页
- 大地基乡初级中学 物理 学科实验报告单2页
- 大学物理实验报告模板.6页
- 大学物理实验报告5页
- 光栅物理实验报告4页
- 黄山的物理仿真实验报告7页
- 建筑物理光学实验报告最终版 213页
- UML实验报告-网上书店11页
- 网上书店系统web实验报告(代码+数据库+前台)40页
- 网上书店设计与使用-实验报告15页
- JSP网上书店系统实验报告12页
- UML综合实验报告网上书店系统21页
- 网上书店实验报告82页
- erp实验报告模板20124页
- erp实验报告24页
- erp实验报告25页
- erp实验报告7页
- 财信 用友 erp实验报告22页
- erp实验报告3页
- 编译原理实验报告26页
- 编译原理实验报告1编译原理实验报告310页
- 中南大学 软件学院 编译原理实验报告216页
- 中南大学 软件学院 编译原理实验报告18页
- 北方工业大学计算机专业编译原理实验报告——语法分析器详细代码报告15页
- 《系统软件课程设计-编译原理》实验报告3页
- spss刘路路实验报告六5页
- spss实验报告四5页
- spss实验报告三4页
- spss实验报告六5页
- spss实验报告32页
- 统计模拟实习-spss实验报告70页


