ImageVerifierCode 换一换
格式:DOCX , 页数:9 ,大小:15.95KB ,
资源ID:6840076      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/6840076.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(C程序设计教程 第一版 龚沛曾 杨志强 著 高等教育出版社 课后答案.docx)为本站会员(b****5)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

C程序设计教程 第一版 龚沛曾 杨志强 著 高等教育出版社 课后答案.docx

1、C 程序设计教程 第一版 龚沛曾 杨志强 著 高等教育出版社 课后答案C 程序设计教程 第一版 (龚沛曾 杨志强 著) 高等教育出版社 课后答案一、选择题1-4CACC 5AC6-10DBDCB 11-15AABDD二、阅读程序,写出运行结果1、conlcalled.con2called. mcon3called.a=0,b=0a=10,b=10 oa=10,b=202、 c0 51 5 网2 5 .3 5 案4 5 w3、 答4 后5 a6 课4、 d10,106,6 h7,95、 kx=0x=10x=7 .三、编程题w1、#includeclassCatprivate: intage; d

2、oubleweight; charcolor;public: voidset(inta,doublew,charc) age=a;weight=w;color=c; intgetage() returnage; doublegetweight() returnweight; chargetcolor() returncolor; voidprint() coutage=age,weight=weight,color=colorendl; m;voidmain() o Cata,b; a.set(4,7.8,r); c b.set(1,2.0,y); coutage=a.getage()endl

3、; coutweight=a.getweight()endl; 网 coutcolor=a.getcolor()s; k voidout() puts(s); . intlen() char*p=s; while(*p!=0) wp+; return(p-s); friendMystringstrcat(Mystrings1,Mystrings2); Mystringstrcat(Mystrings1,Mystrings2) char*p=s1.s,*q=s2.s; while(*p!=0) p+; while(*q!=0) *p=*q; p+; q+; m *p=0; returns1; o

4、voidmain() c Mystringp1,p2,p3; p1.in();p2.in(); 网 p1.out();p2.out(); . coutp1长度为p1.len()endl; 案 coutp2长度为p2.len()endl; w p3=strcat(p1,p2); p3.out(); 后 cout连接以后的长度为p3.len()endl; a 课 d3、#includeiostream.hclassPoint hprivateo:ublex,y; kpublic: Point(doublea,doubleb) x=a;y=b; doublegetx() returnx; doubl

5、egety() wreturny; voidmove(doublei,doublej) x+=i;y+=j; ;classCircle:privatePointprivate: doubler;public: Circle(doublea,doubleb,doublet):Point(a,b) r=t; doublegetr() returnr; doublef1() return(Point:getx(); doublef2() m return(Point:gety(); doublearea() return3.14159*r*r; o; cvoidmain() PointA(2,2);

6、 CircleB(2,3,1); 网 coutPointAis(A.getx(),A.gety().endl; . A.move(3,2); 案 coutPointAis(A.getx(),A.gety().endl; w cout圆心:(B.f1(),B.f2(), 半径r=B.getr()endl; coutTheareaisB.area()endl; a 课 d4、#includeiostream.h hclasspointprivate:X,Y; k public: point(intx=0,inty=0) X=x; Y=y; voidprint() wcout点的坐标:(X,Y)en

7、dl; friendpointoperator+(point&a,point&b); ;pointoperator+(point&a,point&b) returnpoint(a.X+b.X,a.Y+b.Y); voidmain() pointp1(3,4),p2(6,8),p3; p1.print(); p2.print(); p3=p1+p2; p3.print(); m5、#includeiostream.h oclassteacher private: c inthour; public: teacher(inth=0) 网 hour=h; . intgeth() 案 w return

8、hour; 答 后 a voidprint() 课 cout课时数是:hour小时endl; virtualintwages() h return(0); ; k classprofessor:publicteacher public: professor(inth):teacher(h) w voidprint() w cout基本工资是:3000元endl; cout课时津贴为:40元/小时endl;w teacher:print(); virtualintwages() intw=geth(); return(3000+40*w); ;classassociateprofessor:pu

9、blicteacherpublic: associateprofessor(inth):teacher(h) voidprint() m cout基本工资是:2500元endl; cout课时津贴为:25元/小时endl; teacher:print(); o virtualintwages() c intw=geth(); return(3000+40*w); 网; .classlecturer:publicteacher 案public: 答 w lecturer(inth):teacher(h) 后 voidprint() a 课 cout基本工资是:2000元endl; cout课时津贴为:25元/小时print(); cout该教授的工资是:wages()print(); cout该副教授的工资是:wages()print(); cout该讲师的工资是:wages()endl; m co 网 . 案 w 答 后 a 课 d kh w.ww

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1