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

加入VIP,免费下载
 

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

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

下载须知

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

版权提示 | 免责声明

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

C++面向对象程序设计第六版第一章编程题答案.docx

1、C+面向对象程序设计第六版第一章编程题答案INSTRUCTORS RESOURCE GUIDE SOLUTIONS TO PROGRAMMING PROJECTSTO ACCOMPANYPROBLEMSOLVINGWITHC+THE OBJECTOF PROGRAMMINGSixth EditionWalter SavitchUNIVERSITY OF CALIFORNIA, SAN DIEGOThis instructors manual is based on the fourth edition.http:/www.aw-and please visit our general comp

2、uter science and engineering web site at:http:/www.aw-Copyright 2007 by Addison-Wesley Publishing Company All right reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photo-copying, recording, or

3、 any other media embodiments now known or hereafter to become known, without the prior written permission of the publisher. Manufactured in the United States of America.Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where these des

4、ignations appear in this book, and the publisher was aware of a trademark claim, the designations have been printed in initial caps or all caps.The programs and the applications presented in this book have been included for their instructional value. They have been tested with care but are not guara

5、nteed for any particular purpose. The publisher does not offer any warranties or representations, nor does it accept any liabilities with respect to the programs or applications.Addison-Wesley Publishing Company2725 Sand Hill RoadMenlo Park, CA 94025ContentsPreface Chapter 1 Introduction to Computer

6、s and C+ Programming Chapter 2 C+ Basics Chapter 3 More Flow of Control Chapter 4 Procedural Abstraction and Functions that Return a Value Chapter 5 Functions for all SubtasksChapter 6 I/O Streams as an Introduction to Objects and Classes Chapter 7 Arrays Chapter 8 Strings and Vectors Chapter 9 Poin

7、ters and Dynamic ArraysChapter 10 Defining Classes Chapter 11 Friends and Overloaded Operators Chapter 12 Separate Compilation and NamespacesChapter 13 Pointers and Linked Lists Chapter 14 RecursionChapter 15 InheritanceChapter 16 Exception HandlingChapter 17 TemplatesChapter 18 Standard Template Li

8、braryPrefaceThis is a document that is meant to be a supplement the text for the instructor. There is a discussion of the ideas in each chapter, teaching suggestions, and some supplementary ideas. There are solutions to many of the programming problems. Some problems have several different solutions

9、 that correspond to different paths through the book. There are 25 to 50 test questions with answers and discussion for each chapter. The questions are of both short answer (multiple choice, true false, fill in the blank) type as well as read-the-code questions and short programming problems. I urge

10、 that explanations to the short answer questions be required of the student.With regard to the content of this manual, it should be noted that C+ leaves many options on how to do any problem, and any book will necessarily choose a subset to present. Our author has made such a set of choices. I have

11、also made what I hope is a complementary set of choices for this Instructors resource Manual. I am striving to produce a complementary document to the text, a document for the instructor, but I necessarily will do some things differently. Please do not hold the student responsible for what I have pu

12、t here. The reader of this document must note that it is necessary to read the text, as that is what the student has to work with. In spite of our efforts at consistency of content and style, there will be some variance between some of the presentation here and the presentation in the text.The code

13、has been compiled and tested with g+ (gcc 3.4.4), Visual Studio C+ .NET 2003, Visual Studio C+ .NET 2005, Visual Studio C+ Express .NET, and Visual Studio C+ 6.0 updated to service pack 6. Users of Microsoft Visual Studio C+ 6.0 may experience the most incompatibilities and should ensure that servic

14、e pack 6 is downloaded and installed from the Microsoft website. The text uses only mainstream features of C+, consequently, most compilers will compile the code and produce output that does not differ significantly from the results presented here. We have attempted to supply warnings where any of t

15、hese compilers gives trouble.Instructors Resource ManualforSavitch, Problem Solving with C+: The Object of Programming.Chapter 1Introduction to Computers and C+ ProgrammingThis document is intended to be a resource guide for instructors using Savitch, Problem Solving with C+: The Object of Programmi

16、ng. This guide follows the text chapter by chapter. Each chapter of this guide contains the following sections:1. Outline of topics in the chapter2. General remarks on the chapter3. Solutions to, and remarks on, selected Programming Projects4. Test Questions5. Answers to the test QuestionSolutions a

17、nd remarks on selected Programming ProjectsThese programming exercises are intended to help familiarize the student with the programming environment. Solutions are very system dependent. Consequently, only one solution is provided for the programming projects in this chapter./ Ch1Proj8.cpp/ This pro

18、gram calculates the monetary value of a number of/ quarters, dimes, and nickels./ *#include using namespace std;/ =/ main function/ =int main() int quarters, dimes, nickels, total; / Input coins cout Enter number of quarters. quarters; cout Enter number of dimes. dimes; cout Enter number of nickels.

19、 nickels; / Calculate and output total total = (quarters * 25) + (dimes * 10) + (nickels * 5); cout The monetary value of your coins is total cents. endl; return 0;Outline of Topics in the Chapter 11.1 Computer Systems1.2 Programming and Problem-Solving1.3 Introduction to C+1.4 Testing and Debugging

20、Suggested course outlines:There seem to be three major approaches to teaching C+ as the first course in programming. In the one approach, classes and objects are done very early, frequently with a library of some sort that must be used with the text. In another, all of the ANSI C subset of C+ is cov

21、ered prior to even mentioning classes or objects. This text takes a third road that is more middle of the road. Here, enough of the control constructs and functions are covered prior to doing classes and objects. However, reorderings of the chapters are possible that allow any of these approaches. H

22、ere is a classes early course that follows the text closely. This outline assumes no background in computing. Topics beyond Chapter 11 may be studied as time permits. Day days allotted1 1 Startup business2-3 2 Chapter 1: Introduction to Computers4-8 5 Chapter 2: C+ Basics. If the students have progr

23、amming experience, the time spent can be significantly reduced. 9-11 3 Chapter 3: Procedural Abstraction and functions that return a value12-14 3 Chapter 4: Functions for all subtasksTest 116-18 3 Chapter 5: I/O Streams as introduction to Objects and Classes19-22 4 Chapter 6: Defining Classes23-27 5

24、 Chapter 7: More Flow of ControlTest 229-32 4 Chapter 8:Friends and Overloaded Operators Chapter 9 Separate Compilation and Namespaces33-37 5 Chapter 10: Arrays38-41 3 Chapter 11: Strings and VectorsTest 3 5 Chapter 12 Pointers, Dynamic Arrays 3 Chapter 13 Recursion 3 Chapter 14: Templates 3 Chapter

25、 15: Pointers and Linked Lists 3 Chapter 16: Inheritance 3 Chapter 17: Exception HandlingReorderings:The author suggests a reordering in the preface that allow almost all of ANSI C (with the tighter C+ type-checking) to be covered before classes. Several variants on this reordering that allow classe

26、s a bit earlier are presented in the text. The author describes interdependency of the chapters in the preface of the text. Other reorderings are certainly possible.Chapter 1:The student should do all the programming assignments in this chapter. These teach the locally available program development

27、system and familiarize the student with some of the more common compiler errors. Error messages are quite specific to the compiler being used. It is very important that the student learn these ideas as early as possible.Outline of topics in the chapter:1.1 Computer Systems1.2 Programming and Problem

28、-Solving1.3 Introduction to C+1.4 Testing and DebuggingGeneral remarks on the chapterThis chapter serves as an introduction to computers and the language of computers for those students who have no computer experience. The terminology is very important. Many students only want to learn how the progr

29、amming language works, and seem to be unhappy when they find that they are required to learn the terminology associated with the language. The students who learn the terminology have less trouble by far with this course.Students should be given an indication of the amount of work that must be done b

30、efore coding begins. There are instances where several man-years of work have gone into software before a single line of code was written. Emphasize the importance of the problem-solving phase of program design. This will save the student work in the long run. It is further important to emphasize th

31、at the problem definition and algorithm design phases may need correcting once the actual coding and testing is in process. This is true even if the algorithm was carefully desktop tested. Emphasize that the program design process is an iterative process. You make a start, test, correct and repeat until you have a solution.It is a fact that the sooner the coding is started (on most problems), the longer the problem will take to finish. My students insi

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

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