本书介绍使用C++进行程序设计和软件开发的基本原理,适用作大学各专业学生学习面向对象程序设计课的教材。全书共15章:1、计算机和面向对象设计方法学;2、C++基础;3、限定对象;4、控制构造;5、使用基本库函数;6、程序员自定义函数;7、类构造和面向对象设计;8、实现抽象数据类型;9、列表;10、EzWindows API图形库;11、指针和动态内存管理;12、测试和排错;13、继承;14、模板和多态性;15、软件开发项目。本书遵循C++国际标准(ISO/IEC FDIS 14882;X3J16//97-14882);增添了新的语言类型(bool,namespaces和exceptions)。为帮助初学者,作者开发了可移植的面向对象图形库(EzWindows)和标准模板库(STL)。根据使用者的建议,作者在本书中增加一章测试和排错。本书附CD-ROM一张。本书按C++国际标准补充了150个标准类;添加了许多有价值的例子和练习。
Preface\r\n\r\nChapter 1 Computing and the object-oriented design methodology\r\n\r\n1.1 Basic computing terminology\r\nSelf-check questions\r\n1.2 Software\r\n1.3 Engineering software\r\n1.4 Object-oriented design\r\nSelf-check questions\r\n1.5 Points to remember\r\n1.6 To delve further\r\n1.7 Exercises\r\n\r\nChapter 2 C++:The fundamentals\r\n\r\n2.1 Program organization\r\n2.2 A first program\r\n2.3 A second program\r\n2.4 Comments\r\nSelf-check questions\r\n2.5 Assigning a value\r\n2.6 Fundamental C++objects\r\n2.7 Constants\r\nSelf-check questions\r\n2.8 Names\r\n2.9 Definitions\r\nSelf-check questions\r\n2.10 Expressions\r\nSelf-check questions\r\n2.11 Output statements\r\n2.12 Computing average velocity\r\nSelf-check questions\r\n2.13 Points to remember\r\n2.14 Exercises\r\n\r\nChapter 3 Modifying objects\r\n\r\n3.1 Assignment\r\n3.2 Const definitiions\r\n3.3 Input statements\r\nSelf-check questions\r\n3.4 Computing the number of molecules in a hydrocarbon\r\n3.5 Compound assignment\r\n3.6 Increment and decrement\r\nSelf-check questions\r\n3.7 Estimating yearly savings of change\r\n3.8 The string class\r\nSelf-check questions\r\n3.9 EzWindows\r\n3.10 Mowing lawns\r\nSelf-check questions\r\n3.11 Points to remember\r\n3.12 Exercises\r\n\r\nChapter 4 Control constructs\r\n\r\n4.1 Boolean algebra\r\n4.2 A Boolean type\r\nSelf-check questions\r\n4.3 Conditional execution using the if statement\r\nSelf-check questions\r\n4.4 Conditional execution using the switch statement\r\n4.5 Computing a requested expression\r\n4.6 Validating a date\r\nSelf-check questions\r\n4.7 Iteration using the while statement\r\n4.8 Simple string and character processing\r\nSelf-check questions\r\n4.9 Iteration using the for construct\r\n4.10 Simple data visualization\r\n4.11 Solving the lazy hobo riddle\r\n4.12 Iteration using the do construct\r\nSelf-check questions\r\n4.13 Points to remember\r\n4.14 Exercises\r\n\r\nChapter 5 Function basics\r\n\r\n5.1 Function basic\r\n5.2 The preprocessor\r\nSelf-check questions\r\n5.3 Using software libraries\r\n5.4 The iostream library\r\n5.5 The iomanip library\r\n5.6 The fstream library\r\n5.7 Random numbers\r\n5.8 The assert library\r\nSelf-check questions\r\n5.9 Points to Remember\r\n5.10 To delve further\r\n5.11 Exercises\r\n\r\nChapter 6 Programmer-defined Functions\r\n\r\n6.1 Basics\r\n6.2 A tasty problem\r\n6.3 Some useful functions\r\n6.4 Integrating a quadratic polynomial\r\n6.5 The local scope\r\n6.6 The global scope\r\nSelf-check questions\r\n6.7 Reference parameters\r\n6.8 Passing objects by reference\r\n6.9 Validating telephone access codes\r\nSelf-check questions\r\n6.10 Constant parameters\r\n6.11 Default parameters\r\n6.12 Casting of function parameters\r\n6.13 Function overloading\r\nSelf-check questions\r\n6.14 Recursive functions\r\nSelf-check questions\r\n6.15 Displaying a price-interval stock chart\r\n6.16 Points to Remember\r\n6.17 To delve further\r\n6.18 Exercises\r\n\r\nChapter 7 The class construct and object-oriented design\r\n\r\n7.1 Introducing a programmer-defined data type\r\n7.2 The RectangleShape class\r\nSelf-check questions\r\n7.3 Using the RectangleShape class\r\n7.4 Constructors\r\nSelf-check questions\r\n7.5 Building a kaleidoscope\r\n7.6 Object-oriented analysis and design\r\n7.7 Points to remember\r\n7.8 To delve further\r\n7.9 Exercises\r\n\r\nChapter 8 Implementing abstract data types\r\n\r\n8.1 Introducing abstract data types\r\n8.2 Rational ADT basics\r\n8.3 Rational interface description\r\nSelf-check questions\r\n8.4 Implementing the rational class\r\n8.5 Copy construction,member assignment,and destruction\r\nSelf-check questions\r\n8.6 ADT for pseudorandom integers\r\n8.7 Red-yellow-green game\r\n8.8 Points to remember\r\n8.9 Exercises\r\n\r\nChapter 9 Lists\r\n\r\n9.1 Named collections\r\n9.2 One-dimensional arrays\r\nSelf-check questions\r\n9.3 Arrays as parameters\r\n9.4 Sorting\r\nSelf-check questions\r\n9.5 Container classes\r\n9.6 Class vector\r\n9.7 QuickSort\r\n9.8 Binary searching\r\n9.9 String class revisited\r\nSelf-check questions\r\n9.10 Find that word-exploring a two-dimensiional list\r\n9.11 Maze runner\r\n9.12 Multidimensional arrays\r\nSelf-check questions\r\n9.13 Points to remember\r\n9.14 Exercises\r\n\r\nChapter 10 The EzWindows API:a detailed examination\r\n\r\n10.1 Application programmer interfaces\r\n10.2 A simple window class\r\n10.3 The bitmap class\r\n10.4 Mouse events\r\n10.5 Bitmaps and mouse events\r\n10.6 Timer events\r\n10.7 Alert messages\r\nSelf-check questions\r\n10.8 Simon says\r\n10.9 Points to remember\r\n10.10 Exercises\r\n\r\nChapter 11 Pointers and dynamic memory\r\n\r\n11.1 Lvalues and rvalues\r\n11.2 Pointer basic\r\nSelf-check questions\r\n11.3 Constant pointers and pointers to constants\r\n11.4 Arrays and pointers\r\n11.5 Character string processing\r\n11.6 Program command-line parameters\r\nSelf-check questions\r\n11.7 Pointers to functions\r\nSelf-check questions\r\n11.8 Dynamic objects\r\n11.9 A simple ADT for representing lists of integer values\r\nSelf-check questions\r\n11.10 Points to remember\r\n11.11 Exercises\r\n\r\nChapter 12 Testing and debugging\r\n\r\n12.1 Testing\r\nSelf-check questions\r\nSelf-check questions\r\n12.2 Debugging\r\nSelf-check questions\r\n12.3 Points to remember\r\n12.4 To Delve Further\r\n12.5 Exercises\r\n\r\nChapter 13 Inheritance\r\n\r\n13.1 Object-oriented design using inheritance\r\n13.2 Reuse via inheritance\r\n13.3 A hierarchy of shapes\r\nSelf-check questions\r\n13.4 Protected members and inheritance\r\n13.5 Controlling inheritance\r\nSelf-check questions\r\n13.6 Multiple inheritance\r\nSelf-check questions\r\n13.7 A prettier kaleidoscope\r\n13.8 Points to remember\r\n13.9 Exercises\r\n\r\nChapter 14 Templates and polymorphism\r\n\r\n14.1 Generic actions and types\r\n14.2 Function templates\r\n14.3 Class templates\r\n14.4 A simple list class using a class template\r\nSelf-check questions\r\n14.5 Sequential lists\r\nSelf-check questions\r\n14.6 Polymorphism\r\n14.7 Virtual function nuances\r\n14.8 Abstract base classes\r\n14.9 Virtual multiple inheritance\r\nSelf-check questions\r\n14.10 Points to remember\r\n14.11 Exercises\r\n\r\nChapter 15 Software project-Bug Hunt!\r\n\r\n15.1 Bug hunt\r\n15.2 Base class Bug\r\n15.3 Class GameController\r\n15.4 Bug hunt\r\nSelf-check questions\r\n15.5 Points to remember\r\n15.6 Exercises\r\n\r\nAppendix A Tables\r\n\r\nA.1 ASCII character set\r\nA.2 Operator precedence\r\n\r\nAppendix B Standard libraries\r\n\r\nB.1 Library naming and access\r\nB.2 Iostream library\r\nB.3 Stdlib library\r\nB.4 Math library\r\nB.5 Time library\r\nB.6 Cstring library\r\nB.7 Algorithm library\r\n\r\nAppendix C Standard classes\r\n\r\nC.1 Container Classes\r\nC.2 Class string\r\n\r\nAppendix D Advanced topics\r\n\r\nD.1 Namespaces\r\nD.2 Exception handling\r\nD.3 Friends\r\n\r\nAppendix E EzWindows API reference manual\r\n\r\nE.1 Enumerated types\r\nE.2 Coordinate system\r\nE.3 Class Position\r\nE.4 Class SimpleWindow\r\nE.5 Class WindowObject\r\nE.6 Class RaySegment\r\nE.7 Class Shape\r\nE.8 Class EllipseShape\r\nE.9 Class CircleShape\r\nE.10 Class RectangleShape\r\nE.11 Class TriangleShape\r\nE.12 Class SquareShape\r\nE.13 Class Label\r\nE.14 Class BitMap\r\nE.15 Class Randomlnt\r\nE.16 Miscellaneous functions\r\n\r\nAppendix F Projects and makefiles\r\n\r\nF.1 Project and makefile fundamentals\r\nF.2 Borland C++ IDE\r\nF.3 Microsoft Visual C++ IDE\r\nF.4 UNIX Makefiles\r\n\r\nIndex