Object Oriented Programming in C++ ppt

988 6.3K 2
Object Oriented Programming in C++ ppt

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Waite Group's Object-Oriented Programming in C++, Third Edition (Publisher: Macmillan Computer Publishing) Author(s): Robert Lafore ISBN: 157169160x Publication Date: 11/25/98 Bottom of Form Previous Table of Contents Next Preface The major changes to this Third Edition are concerned with Standard C ++ and object-oriented design. In addition, the book is no longer geared exclusively to Borland C ++ compilers. Standard C ++ , finalized in the fall of 1997, introduced many new features to C ++ . Some of these features, such as templates and exceptions, had already been adopted by compiler manufacturers. However, the Standard Template Library (STL) has only recently been included in compilers. This book adds a chapter on the STL. We’ve also introduced other features from Standard C ++ , including new header files, the string class, new-style casts, namespaces, and so on. The design of object-oriented programs has received increasing emphasis in recent years, so we’ve added a chapter on object-oriented design. The advent of Standard C ++ means that, at least to a greater extent than before, all compilers should treat source code in the same way. Accordingly, we’ve modified our emphasis on Borland compilers, and now focus on code that should work with any Standard C ++ compiler. Of course, the reality seldom matches the ideal, so so the programs in this book have been tested with both Microsoft and Borland compilers, and modified when necessary to work with both of them. Previous Table of Contents Next Page 1 ABC Amber CHM Converter Trial version, http://www.processtext.com/abcchm.html Waite Group's Object-Oriented Programming in C++, Third Edition (Publisher: Macmillan Computer Publishing) Author(s): Robert Lafore ISBN: 157169160x Publication Date: 11/25/98 Bottom of Form Previous Table of Contents Next About the Author Robert Lafore has been writing books about computer programming since 1982. His best-selling titles include Assembly Language Programming for the IBM PC, C Programming Using Turbo C ++ , C ++ Interactive Course, and Data Structures and Algorithms in Java. Mr. Lafore holds degrees in mathematics and electrical engineering, and has been active in programming since the days of the PDP-5, when 4K of main memory was considered luxurious. His interests include hiking, windsurfing, and recreational mathematics. Acknowledgments to the Third Edition I’d like to thank the entire team at Macmillan Computer Publishing. In particular, Tracy Dunkelberger ably spearheaded the entire project and exhibited great patience with what turned out to be a lengthy schedule. Jeff Durham handled the myriad details involved in interfacing between me and the editors with skill and good humor. Andrei Kossorouko lent his expertise in C ++ to ensure that I didn’t make this edition worse instead of better. Acknowledgments to the Second Edition My thanks to the following professor—susers of this book as a text at their respective colleges and universities—for their help in planning the second edition: Dave Bridges, Frank Cioch, Jack Davidson, Terrence Fries, Jimmie Hattemer, Jack Van Luik, Kieran Mathieson, Bill McCarty, Anita Millspaugh, Ian Moraes, Jorge Prendes, Steve Silva, and Edward Wright. I would like to thank the many readers of the first edition who wrote in with corrections and suggestions, many of which were invaluable. At Waite Group Press, Joanne Miller has ably ridden herd on my errant scheduling and filled in as academic liaison, and Scott Calamar, as always, has made sure that everyone knew what they were doing. Deirdre Greene provided an uncannily sharp eye as copy editor. Thanks, too, to Mike Radtke and Harry Henderson for their expert technical reviews. Special thanks to Edward Wright, of Western Oregon State College, for reviewing and experimenting with the new exercises. Acknowledgments to the First Edition My primary thanks go to Mitch Waite, who poured over every inch of the manuscript with painstaking attention to detail and made a semi-infinite number of helpful suggestions. Bill McCarty of Azusa Pacific University reviewed the content of the manuscript and its suitability for classroom use, suggested many excellent improvements, and attempted to correct my dyslexic spelling. Page 2 ABC Amber CHM Converter Trial version, http://www.processtext.com/abcchm.html George Leach ran all the programs, and, to our horror, found several that didn’t perform correctly in certain circumstances. I trust these problems have all been fixed; if not, the fault is entirely mine. Scott Calamar of The Waite Group dealt with the myriad organizational aspects of writing and producing this book. His competence and unfailing good humor were an important ingredient in its completion. I would also like to thank Nan Borreson of Borland for supplying the latest releases of the software (among other useful tidbits), Harry Henderson for reviewing the exercises, Louise Orlando of The Waite Group for ably shepherding the book through production, Merrill Peterson of Matrix Productions for coordinating the most trouble-free production run I’ve ever been involved with, Juan Vargas for the innovative design, and Frances Hasegawa for her uncanny ability to decipher my sketches and produce beautiful and effective art. Dedication This book is dedicated to GGL another inodomitable spirit.222 Tell Us What You Think! As the reader of this book, you are our most important critic and commentator. We value your opinion and want to know what we’re doing right, what we could do better, what areas you’d like to see us publish in, and any other words of wisdom you’re willing to pass our way. As the Executive Editor for the Advanced Programming and Distributed Architectures team at Macmillan Computer Publishing, I welcome your comments. You can fax, email, or write me directly to let me know what you did or didn’t like about this book—as well as what we can do to make our books stronger. Please note that I cannot help you with technical problems related to the topic of this book, and that due to the high volume of mail I receive, I might not be able to reply to every message. When you write, please be sure to include this book’s title and author as well as your name and phone or fax number. I will carefully review your comments and share them with the author and editors who worked on the book. Fax: 317-817-7070 Email: programming@mcp.com Mail: Tracy Dunkelberger Executive Editor Advanced Programming and Distributed Architectures Macmillan Computer Publishing 201 West 103rd Street Indianapolis, IN 46290 USA Previous Table of Contents Next Page 3 ABC Amber CHM Converter Trial version, http://www.processtext.com/abcchm.html Waite Group's Object-Oriented Programming in C++, Third Edition (Publisher: Macmillan Computer Publishing) Author(s): Robert Lafore ISBN: 157169160x Publication Date: 11/25/98 Bottom of Form Previous Table of Contents Next APPENDIX A ASCII Chart Table A.1 IBM Character Codes DEC HEX Symbol Key Use in C 0 00 (NULL) Ctrl 2 1 01 A Ctr A 2 02 B Ctrl B 3 03 C Ctrl C 4 04 D Ctrl B 5 05 E Ctrl E 6 06 F Ctrl F 7 07 G Ctrl G Beep 8 08 H Backspace Backspace 9 09 I Tab Tab 10 0A J Ctrl J Linefeed (new line) 11 0B K Ctrl K Vertical Tab 12 0C L Ctrl L Form Feed 13 0D M Enter Carriage Return 14 0E N Ctrl N 15 0F O Ctrl O 16 10 P Ctrl P 17 11 Q Ctrl Q 18 12 R Ctrl R 19 13 S Ctrl S 20 14 T Ctrl T 21 15 U Ctrl U 22 16 _ Ctrl V 23 17 W Ctrl W 24 18 X Ctrl X 25 19 Y Ctrl Y 26 1A Z Ctrl Z 27 1B a Escape Page 4 ABC Amber CHM Converter Trial version, http://www.processtext.com/abcchm.html 28 1C b Ctrl \ 29 1D c Ctrl ] 30 1E d Ctrl 6 31 1F e Ctrl – 32 20 SPACE BAR 33 21 ! ! 34 22 “ “ 35 23 # # 36 24 $ $ 37 25 % % 38 26 & & 39 27 ‘ ‘ 40 28 ( ( 41 29 ) ) 42 2A * * 43 2B + + 44 2C , , 45 2D – – 46 2E . . 47 2F / / 48 30 0 0 49 31 1 1 50 32 2 2 51 33 3 3 52 34 4 4 53 35 5 5 54 36 6 6 55 37 7 7 56 38 8 8 57 39 9 9 58 3A : : 59 3B ; ; 60 3C < < 61 3D = = 62 3E > > 63 3F ? ? 64 40 @ @ 65 41 A A 66 42 B B 67 43 C C Page 5 ABC Amber CHM Converter Trial version, http://www.processtext.com/abcchm.html 68 44 D D 69 45 E E 70 46 F F 71 47 G G 72 48 H H 73 49 I I 74 4A J J 75 4B K K 76 4C L L 77 4D M M 78 4E N N 79 4F O O 80 50 P P 81 51 Q Q 82 52 R R 83 53 S S 84 54 T T 85 55 U U 86 56 V V 87 57 W W 88 58 X X 89 59 Y Y 90 5A Z Z 91 5B [ [ 92 5C \ \ 93 5D ] ] 94 5E ^ ^ 95 5F _ _ 96 60 ' ' 97 61 a a 98 62 b b 99 63 c c 100 64 d d 101 65 e e 102 66 f f 103 67 g g 104 68 h h 105 69 i i 106 6A j j 107 6B k k Page 6 ABC Amber CHM Converter Trial version, http://www.processtext.com/abcchm.html 108 6C l l 109 6D m m 110 6E n n 111 6F o o 112 70 p p 113 71 q q 114 72 r r 115 73 s s 116 74 t t 117 75 u u 118 76 v v 119 77 w w 120 78 x x 121 79 y y 122 7A z z 123 7B { { 124 7C | | 125 7D } } 126 7E ~ ~ 127 7F f Ctrl 128 80 Alt 128 129 81 ỹ Alt 129 130 82 ộ Alt 130 131 83 ẫ Alt 131 132 84 ọ Alt 132 133 85 Alt 133 134 86 ồ Alt 134 135 87 ầ Alt 135 136 88 ờ Alt 136 137 89 ở Alt 137 138 8A ố Alt 138 139 8B ù Alt 139 140 8C ợ Alt 140 141 8D ỡ Alt 141 142 8E Alt 142 143 8F Alt 143 144 90 ẫ Alt 144 145 91 ổ Alt 145 146 92 ặ Alt 146 147 93 ụ Alt 147 Page 7 ABC Amber CHM Converter Trial version, http://www.processtext.com/abcchm.html 148 94 ử Alt 148 149 95 ũ Alt 149 150 96 ự Alt 150 151 97 ự Alt 151 152 98 Alt 152 153 99 ệ Alt 153 154 9A ĩ Alt 154 155 9B ừ Alt 155 156 9C Ê Alt156 157 9D Ơ Alt157 158 9E ỷ Alt158 159 9F ỹ Alt159 160 A0 ỏ Alt160 161 A1 ớ Alt161 162 A2 ú Alt162 163 A3 ỳ Alt163 164 A4 ủ Alt164 165 A5 ẹ Alt165 166 A6 a Alt166 167 A7 o Alt167 168 A8 đ Alt168 169 A9 â Alt169 170 AA Alt170 171 AB ' Alt 171 172 AC Alt 172 173 AD Ă Alt 173 174 AE ô Alt 174 175 AF ằ Alt 175 176 B0 Ô Alt 176 177 B1 Ô Alt 177 178 B2 Ô Alt 178 179 B3 Alt 179 180 B4 Ơ Alt 180 181 B5 à Alt 181 182 B6 Alt 182 183 B7 Alt 183 184 B8 Alt 184 185 B9 Alt 185 186 BA Alt 186 187 BB a Alt 187 Page 8 ABC Amber CHM Converter Trial version, http://www.processtext.com/abcchm.html 188 BC o Alt 188 189 BD Ω Alt 189 190 BE æ Alt 190 191 BF ™ Alt 191 192 C0 ¿ Alt 192 193 C1 ¡ Alt 193 194 C2 ¬ Alt 194 195 C3 √ Alt 195 196 C4 ∫ Alt 196 197 C5 ≈ Alt 197 198 C6 Δ Alt 198 199 C7 « Alt 199 200 C8 » Alt 200 201 C9 Alt 201 202 CA g Alt 202 203 CB À Alt 203 204 CC à Alt 204 205 CD Õ Alt 205 206 CE Œ Alt 206 207 CF œ Alt 207 208 D0 – Alt 208 209 D1 — Alt 209 210 D2 " Alt 210 211 D3 " Alt 211 212 D4 Ô Alt 212 213 D5 " Alt 213 214 D6 ÷ Alt 214 215 D7 ◊ Alt 215 216 D8 ÿ Alt 216 217 D9 Ÿ Alt 217 218 DA / Alt 218 219 DB ¤ Alt 219 220 DC < Alt 220 221 DD > Alt 221 222 DE fi Alt 222 223 DF fl Alt 223 224 E0 α Alt 224 225 E1 β Alt 225 226 E2 Γ Alt 226 227 E3 π Alt 227 Page 9 ABC Amber CHM Converter Trial version, http://www.processtext.com/abcchm.html 228 E4 ς Alt 228 229 E5  Alt 229 230 E6 µ Alt 230 231 E7 τ Alt 231 232 E8 Ë Alt 232 233 E9 Θ Alt 233 234 EA Ω Alt 234 235 EB Î Alt 235 236 EC Ï Alt 236 237 ED ψ Alt 237 238 EE Alt 238 239 EF Ô Alt 239 240 F0 ≡ Alt 240 241 F1 + Alt 241 242 F2 ≥ Alt 242 243 F3 ≤ Alt 243 244 F4 Ù Alt 244 245 F5 1 Alt 245 246 F6 ÷ Alt 246 247 F7 Alt 247 248 F8 ° Alt 248 249 F9 • Alt 249 250 FA . Alt 250 251 FB √ Alt 251 252 FC η Alt 252 253 FD ² Alt 253 254 FE < Alt 254 255 FF (blank) Alt 255 Those key sequences consisting of “Ctrl” are typed by pressing the CTRL key, and while it is being held down, pressing the key indicated. These sequences are based on those defined for PC Personal Computer series keyboards. The key sequences may be defined differently on other keyboards. IBM Extended ASCII characters can be displayed by pressing the Alt key and then typing the decimal code of the character on the keypad. Previous Table of Contents Next Page 10 ABC Amber CHM Converter Trial version, http://www.processtext.com/abcchm.html [...]... 1 to range 2, inserting them backwards, from last2 to first2 Interchanges two objects a, b Interchanges objects iter1, iter2 pointed to by two iterators Interchanges first1, last1, first2 corresponding elements in two ranges first1, last1, first2, Transforms objects in operator range 1 into new objects in range 2 by applying ‘ operator’ first1, last1, first2, first3, Combines objects in range operator... programs Start by building your program as you normally would Fix any compiler and linker errors Make sure your program listing is displayed in the Edit window Single Stepping To start the debugger, simply press the F10 key You’ll see a yellow arrow appear in the margin of the listing, pointing to the opening brace following main If you want to start somewhere other than the beginning of the program,... Project.” • Insert the line #include <condefs.h> at the beginning of your program This is necessary for multifile programs • To keep the display on the screen, insert the line getch(); just before the return statement at the end of main() • To support getch(), insert the line #include <conio.h> at the beginning of your program Debugging In Chapter 3, “Loops and Decisions,” we suggest using a debugger... console window remains in view until you press any key The getch() function requires the CONIO.H header file, so you’ll need to include it at the beginning of your program If you’re creating your own program, you can start with the skeleton program and type in your own lines If your starting with an existing file, read the section “Starting with Existing Files.” Saving A Project The text you see in the... within C++Builder, using the Run command from the Run menu, then you’ll need to install a statement at the end of the program to keep the console window on the screen long enough to see You can do this in two steps: • Insert the statement getch(); just before the final return statement in main() This enables you to see the program’s output • Insert the statement #include <conio.h> at the beginning... any objects equal to ‘value’ Removes from range any objects that satisfy ‘ predicate’ Copies objects, excepting those equal to ‘value’, from range 1 to range 2 Copies objects, excepting those satisfying ‘pred’, from range 1 to range 2 Eliminates all but the first object from any consecutive sequence of equal objects Eliminates all but the first object from any consecutive sequence of objects satisfying... to #include<borlacon.h> • Tell the compiler where this MSOFTCON.H header file is by following the instructions in the section earlier in this Appendix titled “Telling C++Builder the Header File’s Location.” (The header should be in a directory called BORLACON.) • Add the source file BORLACON.CPP to your project by following the instructions in the section earlier in this Appendix titled “Adding Additional... when operating C++Builder In Windows Explorer, make sure that the option Hide MS-DOS File Extensions for File Types That are Registered is not checked Running the Example Programs in C++Builder The programs in this book require minor modifications to run under C++Builder Here’s a quick summary You can compile most of the example programs and run them without modification in Window’s MS-DOS window (Start/Programs/MS-DOS... program listing in the edit window You’ll see a dot in the left margin opposite each executable program line Simply left-click the dot where you want to insert the breakpoint You’ll see a red circle appear in the left margin, and the program line will be highlighted Now whenever you run your program at full speed (by selecting Run from the Run menu, for example) it will stop at the breakpoint You can... based on Visual C++ version 5.0 The present version of Visual C++ has good (although not perfect) adherence to Standard C++ It comes in various versions, including a student version for under $100 We’ll assume that Visual C++ is installed in your system, and that you know how to start it by using the Windows Start button and navigating to the appropriate menu item: Microsoft Visual C++ You’ll want . writing books about computer programming since 1982. His best-selling titles include Assembly Language Programming for the IBM PC, C Programming Using. been active in programming since the days of the PDP-5, when 4K of main memory was considered luxurious. His interests include hiking, windsurfing, and recreational

Ngày đăng: 05/03/2014, 20:20

Từ khóa liên quan

Mục lục

  • [Trial version] The Waite Group's Object-Oriented Programming in C++, Third Edition:About the Author

  • [Trial version] The Waite Group's Object-Oriented Programming in C++, Third Edition:About the Author

  • [Trial version] No title

  • [Trial version] No title

  • [Trial version] No title

  • [Trial version] No title

  • [Trial version] No title

  • [Trial version] No title

  • [Trial version] No title

  • [Trial version] No title

  • [Trial version] The Waite Group's Object-Oriented Programming in C++, Third Edition:Index

  • [Trial version] The Waite Group's Object-Oriented Programming in C++, Third Edition:The Big Picture

  • [Trial version] The Waite Group's Object-Oriented Programming in C++, Third Edition:The Big Picture

  • [Trial version] The Waite Group's Object-Oriented Programming in C++, Third Edition:The Big Picture

  • [Trial version] The Waite Group's Object-Oriented Programming in C++, Third Edition:The Big Picture

  • [Trial version] The Waite Group's Object-Oriented Programming in C++, Third Edition:The Big Picture

  • [Trial version] The Waite Group's Object-Oriented Programming in C++, Third Edition:C++ Programming Basics

  • [Trial version] The Waite Group's Object-Oriented Programming in C++, Third Edition:C++ Programming Basics

  • [Trial version] The Waite Group's Object-Oriented Programming in C++, Third Edition:C++ Programming Basics

  • [Trial version] The Waite Group's Object-Oriented Programming in C++, Third Edition:C++ Programming Basics

Tài liệu cùng người dùng

Tài liệu liên quan