欢迎来到天天文库
浏览记录
ID:18077464
大小:79.00 KB
页数:29页
时间:2018-09-13
《《程序设计基础下》实验指导书3》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、《程序设计基础下》实验指导书编写人:张岚第一部分说明《程序设计基础下》的上机实习分为课内上机实习和课外上机实习两部分,课内上机实习学期内共安排36学时,每周安排2次,每次2小时,即学期内共安排36constructionqualityacceptanceandassessmentRegulation(ProfessionalEdition)(DL/T5210.2-2009~DL/T5210.8-2009);1.9thequalitycheckoutandevaluationofelectricequipmentinstallationengine
2、eringcode(DL/T5161.1-2002~5161.17-2002);1.10thenormsofconstructionsupervision,theelectricpowerconstructionsupervisionregulations29次课内上机实习,由机房统一安排,任课老师跟班辅导。学期内还安排18学时的课外上机实习,主要作为课内上机实习的补充,学生用来完成在课内上机实习中没有作完的工作,由学生自己安排上机时间。第二部分实验要求及实验内容实验一类和对象实验目的:学习类的声明方法;掌握类成员函数的定义形式;掌握多文件结构C
3、++程序的组织形式。实验内容:一、阅读下列程序,找出程序中的错误,修改错误并上机验证。#include#includeclassPoint{public:voidSet(doubleix,doubleiy){x=ix;y=iy;}doublexOffset(){returnx;}doubleyOffset(){returny;}doubleangle(){return(180/3.14159)*atan2(y,x);}doubleradius(){returnsqrt(x*x+y*y);}protected
4、:doublex;doubley;};voidmain(){Pointp;doublex,y;constructionqualityacceptanceandassessmentRegulation(ProfessionalEdition)(DL/T5210.2-2009~DL/T5210.8-2009);1.9thequalitycheckoutandevaluationofelectricequipmentinstallationengineeringcode(DL/T5161.1-2002~5161.17-2002);1.10thenorm
5、sofconstructionsupervision,theelectricpowerconstructionsupervisionregulations29cout<<"Enterxandy:";cin>>x>>y;p.Set(x,y);p.x+=5;p.y+=6;cout<<"angle="<
6、和表面积。二、请写出在实验过程中遇到的问题?你是如何解决的?目前仍存在什么问题?实验二类和构造函数和析构函数实验目的:理解对象的概念,掌握对象的定义和使用方法;学习构造函数和析构函数的作用、特点和使用方法。实验内容:一、写出下列程序的运行结果并上机验证。#includeclassSample{public:Sample(){x=y=1;}Sample(inta,intb){x=a;y=b;}~Sample(){if(x==y)cout<<"x=y"<7、dassessmentRegulation(ProfessionalEdition)(DL/T5210.2-2009~DL/T5210.8-2009);1.9thequalitycheckoutandevaluationofelectricequipmentinstallationengineeringcode(DL/T5161.1-2002~5161.17-2002);1.10thenormsofconstructionsupervision,theelectricpowerconstructionsupervisionregulations28、9elsecout<<"x!=y"<
7、dassessmentRegulation(ProfessionalEdition)(DL/T5210.2-2009~DL/T5210.8-2009);1.9thequalitycheckoutandevaluationofelectricequipmentinstallationengineeringcode(DL/T5161.1-2002~5161.17-2002);1.10thenormsofconstructionsupervision,theelectricpowerconstructionsupervisionregulations2
8、9elsecout<<"x!=y"<
此文档下载收益归作者所有