1、湖南人文科技学院计算机系湖南人文科技学院计算机系 课程设计说明书课程设计说明书 课 程 名 称: C+C+面向对象程序设计面向对象程序设计 课 程 代 号: 题 目: 三角形的种类与面积三角形的种类与面积 开 题 时 间: 2011 2011 年年 6 6 月月 13 13 日日 完 成 时 间: 2011 2011 年年 6 6 月月 24 24 日日 目目 录录 摘 要 1 一、引 言. 2 二、设计目的与任务. 2 三、设计方案. 2 1、总体设计 2 2、详细设计.4 3、程序清单.7 4、程序调试与体会12 5、运行结果13 四、结 论 16 五、致 谢 16 六、参考文献 17 第
2、 1 页 摘摘 要要 C+是 C 语言的超集,它不仅保持了与 C 语言的兼容,而且还支持面向对象 程序设计的特征,C+程序在可重用性、可扩充性、可维护性和可靠性等方面都 较 C 语言得到了提高,使其更适合开发大中型的系统软件和应用程序。本文论述 了使用 VC6.0 设计了判断三角形的种类和计算基面积的系统。首先使用 C+中的 类设计了 Point 类、 Line 派生类和 Triangle 多级派生类; 然后再编写 intput()、 al_line()、jud_tri()以及 alg_tri()函数,它们的功能分别是输入数据、计算 边长、 判断种类以及计算和输出面积; 最后在主程序中调用 i
3、ntput()、 al_line()、 jud_tri()以及 alg_tri()函数实现整个程序的运行。经过多次调试,结果成功通 过编译并得出了正确的结果,使我的系统可以正常实现菜单选择、输入数据、进 行判断和计算并输入结果等功能。 关键词:关键词:VC6.0;派生类;多级派生类; Abstract C + + is C language of super set, it not only keeps up with the C language compatible, but also do it support object-oriented program design,which i
4、s the characteristics of the C + + program in the reusability, scalability, and reliability, maintainability.And in such aspects ,C+ have improved, it become more suitable for the development of large and medium-sized system software and application. This paper discusses the problem that useing the VC6.0 to design a system to judge the types of triangle and calculation the area of it.At first,we use the class of C+ to design a class Point,a derived class Line and a multilevel