




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
一、选择题、填一、选择题、填空答案1.C.14.5.10.二、找错、运行结错误原因:具有两个缺省构造函数(重复定义缺省构造函数运行结果Constructorcalled.(0,0,Constructorcalled.6,8,Constructorcalled.0,0,Constructorcalled.3,7,Destructorcalled.3,7,Destructorcalled.6,8,Destructorcalled.(0,0,Constructorcalled.0,0,Constructorcalled.3,7,Destructorcalled.3,7,Destructorcalled.3,7,Destructorcalled.3,7,Destructorcalled.Exitmain()运行结果运行结果Different!copied!Different!copied!三运行结果Different!copied!Different!copied!三、编程classcomplex{voidsetreal(double{}{image=i;doublegetreal({ doublegetimage({return(image);void{elseif(image>0)}void{doublea,b;}classLine{doublea,b;}classLine{{}voidSetPoint2(intx,inty,int{}double{(sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)+(z1-z2)*(z1-}{ voidGetPoint2(int&x,int&y,int{x=x2;y=y2;z=z2;void{cout<<"端点的坐cout<<"线段长度}void{intx,y,z;cin>>x>>y>>z;cin>>x>>y>>z;inta,b,c;}classPoint{voidSetPoint(intx1,int{x=x1;y=y1;voidGetPoint(int&x1,int{x1=x;y1=y;}{x=xx;voidSety(int{y=yy;}intintGety(){returny;class{voidSetPoint1(intxx,int{p[0].SetPoint(xx,yy);}{p[1].SetPoint(xx,yy);}{p[2].SetPoint(xx,yy);}{intp[i-p[j-returnintp[i-p[j-return(sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-}doublePerimeter()//{}{doublea,b,c,s;return(sqrt(s*(s-a)*(s-b)*(s-}void{cout<<"Point3:"<<p[2].Getx()<<','<<p[2].Gety()<<endl;cout<<"Distancefrompoint1topoint2:"<<Distance(1,2)<<endl;cout<<"Distancefrompoint2topoint3:"<<Distance(2,3)<<endl;cout<<"Distancefrompoint1topoint3:"<<Distance(1,3)<<endl;cout<<"Perimeter:"<<Perimeter()<<endl;}void{p[0].Setx(-p[1].Setx(-p[2].Setx(-}void{p[0].Sety(-p[1].Sety(-p[2].Sety(-}voidmove(intxoff,int{//}void}void{Trianglesan;} {voidSetDate(inty,intm,int{{Show();}}intLeapyear({return((year%4==0&&year%100!=0)||}intCheck({intif(month<1||month>12||day<1)}void}voidShow({}void{Dated;} class{{Math,Phisics,Eng,SetNum(char} SetName(char{} {} {} SetFaddr(char{} SetTel(char{} SetEmail(char{}voidSetScore(chartag,intscore); voidStudent::SetScore(chartag,int{{case'm':Math=score;break;case'e':Eng=score;break;case'c':Prog=score;}}void{cout<<"Num:"<<Num<<"\n";cout<<"Sex:"<<Sex<<"\n";cout<<"Tel:"<<Tel<<"\n";cout<<"Eng:"<<Eng<<"\n";}cout<<"Eng:"<<Eng<<"\n";}void{ stud.SetName("LiHong");} classTeacher{{SetNum(char} SetName(char{} } {} SetFaddr(char{} SetTel(char{} SetEmail(char{} SetHeadship(char{} {} SetSalary(int{} void{cout<<"Num:"<<Num<<"\n";cout<<"Name:"<<Name<<"\n";cout<<"Sex:"<<Sex<<"\n";cout<<"Faddr:"<<Faddr<<"\n";cout<<"Tel:"<<Tel<<"\n";cout<<"Email:"<<Email<<"\n";cout<<"Post:"<<Post<<"\n";cout<<"Salary:"<<Salary<<"\n";}void{Teacherteach;teach.SetName("WangSong");void{Teacherteach;teach.SetName("WangSong");}classcomplex{//新{real=0; //新{real=rr; complex(complex//新{} void{elseif(image>0)}void{}classLine{}classLine{Line(inta1=0,intb1=0,intc1=0,inta2=0,intb2=0,int{}{}double{(sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)+(z1-z2)*(z1-} void{cout<<"端点的坐cout<<"线段长度}void{}classPoint{Point(intx1=0,int{x=x1;y=y1;}{x=p.x;y=p.y;voidSet(intx1,int{x=x1;y=y1;voidGet(int&x1,int{x1=x;y1=y;class{Triangle(intx1=0,inty1=0,intx2=0,inty2=0,intx3=0,int{}Triangle(Pointpp1,Pointpp2,Point{p1=pp1;p2=pp2;}voidSetPoint1(intxx,int{}voidSetPoint2(intxx,int{}voidSetPoint3(Point{}voidGetPoint1(int*px,int{}voidGetPoint2(int}voidGetPoint2(int&px,int{p2.Get(px,}{}doubleDistance(Pointp1,Point{return(sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-}doublePerimeter()//{}{doublea,b,c,s;return(sqrt(s*(s-a)*(s-b)*(s-}void{cout<<"Distancefrompoint1topoint2:"<<Distance(p1,p2)<<endl;cout<<"Distancefrompoint2topoint3:"<<Distance(p2,p3)<<endl;cout<<"Distancefrompoint1topoint3:"<<Distance(p1,p3)<<endl;cout<<"Perimeter:"<
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 计算机二级JAVA设计失误警示试题及答案
- 逻辑运算符应用试题及答案
- 计算机二级Web开发技术试题及答案
- 自然主义文学的特征文学概论试题及答案
- 网络拓扑示例试题及答案
- 计算机四级嵌入式实践经验试题及答案
- 嵌入式系统工程师考试题型及答案
- 计算机四级嵌入式考试知识图谱试题及答案
- 2025版高考生物一轮复习第8单元第3讲免疫调节教学案苏教版必修3
- Access表单创建与操作试题及答案解析
- GB/T 11378-2005金属覆盖层覆盖层厚度测量轮廓仪法
- 区块链金融课件
- DB32T 3842-2020 土工袋护坡技术规范
- 拆除工程原始记录
- 谁是卧底?班会课游戏
- 神话故事相关的英语习语
- 调味品QS审查细则
- 《淹溺急救》PPT课件(2022版)
- 四川省职工住房补贴实施办法
- 辽宁医院明细.xls
- JYC全自动变频抗干扰介质损耗测试仪
评论
0/150
提交评论