on Orders of $25 or more*
|Get your books quickly and easily... and pay nothing for shipping. Just order $25 or more and standard shipping is on us (excludes Marketplace and Rental offerings).|
|$3.99 flat rate|
|UPS 2nd Day Air*||$11.99 flat rate|
|UPS Next Day Air*||$19.98 flat rate|
* Not available for PO boxes and APO/FPO
** Saturday delivery is only available in certain areas. UPS standard rates apply.
*** Separate shipping rates apply for bulk orders
Applications Programming in C++ is based on C++ courses given by the authors at DePaul University over the last several years. We assume no prior knowledge of C++, but we do assume programming experience in some high-level language. We provide Chapter 0 as background for those with modest programming experience. More advanced users can begin with Chapter 1. The book can be used for a one-term course in applications programming in C++ or for self-study.
The book and its supplements---an Instructor's Guide and a World Wide Web site---provide a comprehensive support system to help the reader master C++. The book includes numerous examples, exercises, sample applications, programming exercises, lists of common programming errors, and illustrations.
During the 1980s and early 1990s, C became the language of choice for many applications and systems programmers. Most major software available for personal computers was written in C: spreadsheets, word processors, databases, communications packages, statistical software, graphics packages, and so on. Virtually all software written for the UNIX environment was likewise written in C, and many mainframe systems meant to be ported from one platform to another were also coded in C. In the early 1980s, Bjarne Stroustrup of AT\&T Bell Labs developed C++ as an extension of C that supports object-oriented programming, a type of programming that is well suited to the large, complex software systems now written for all platforms, from the cheapest personal computers to the most expensive mainframes. C++ also corrects some shortcomings in C, which C++ includes as a subset, and it supports abstract data types and generic functions through templates.
C++ is a highly complex language. Fortunately, most C++ programmers can benefit from its power without mastering each and every one of its features. Because this is an introductory book, we focus on the most useful aspects of the language; but we place some of the more esoteric and specialized parts of the language in end-of-chapter sections labeled C++ Postscript. We focus on using C++ to write practical programs based on sound design techniques, rather than on tricks and surprises in C++.
This book includes the following features:
C++: A Hybrid Language
C++ is essentially C with extensions to support object-oriented programming. Because C supports traditional, procedural programming, C++ is a hybrid language; it supports both procedural and object-oriented programming. It is a challenge to teach both procedural and object-oriented programming in the same course and to develop pedagogical strategies to address both programming paradigms. This book reflects our belief, based on our experience teaching C++, that some procedural programming is necessary before moving on to the object-oriented parts of C++. Thus we first cover basic control structures (e.g., loops, if statements), data types, operators, arrays, and functions. Once the basics of C++ as a procedural language have been covered, we introduce classes, inheritance, and polymorphism---the key concepts in object-oriented programming. We then turn to operator overloading, storage, templates, and other C++ features. This approach is justified because:
Organization of the Book
Chapter 0 serves as an introduction to computer systems and program development. (This chapter can be skipped if this material is already known.) We begin in Section 0.1 by discussing algorithms. Section 0.2 presents an overview of computer systems including hardware (main memory, CPU, etc.) and software (text editors, compilers, etc.). Internal representations of integers, floating-point numbers, characters, and instructions are discussed in Section 0.3. Section 0.4 continues with a discussion of programming languages (assembly languages and high-level languages). Section 0.5 summarizes the phases of program development: program specification, algorithm design, coding, and testing. In addition, several problem-solving strategies are given in Section 0.5. A discussion of the C++ language (Section 0.6) concludes Chapter 0.
Chapters 1 through 4 are devoted to the basics of C++ as a procedural language. In Chapter 1 we discuss integer and floating-point data types; identifiers; and arithmetic, relational, and logical operators. After Chapter~1, readers can immediately begin writing simple, but useful, programs.
In Chapter 2, we discuss the if-else statement; while, do while, and for loops; files; the assignment, increment, and decrement operators; the break, continue, and switch statements; promotions and casts; and basic formatting. Because C++ programs compiled under Windows are best used with disk input and output files, we treat files early.
Functions and program structure are discussed in Chapter 3. Parameters and call by value are covered in Sections 3.1 through 3.3. Call by reference is the topic of Section 3.5. Function overloading is introduced in Section 3.7. Recursion is the topic of Section 3.8. Sections 3.4 and 3.6 are devoted to sample applications.
Chapter 4 is devoted to arrays. Pointers and character strings are introduced to underscore their connection with arrays.
After covering the basics of C++ as a procedural language, we introduce the object-oriented features: classes, inheritance, and polymorphism. We cover class basics in Chapter 5: classes and objects, data members and methods, constructors and the destructor, defining classes and using them in programs, and using existing class libraries.
Chapter 6 introduces inheritance, including protected members, and constructors and the destructor under inheritance.
Polymorphism (run-time binding) is the topic of Chapter 7. Also, in this chapter, we discuss the difference between run-time binding and features that resemble it. This chapter also explains how an abstract base class can be used to specify an interface and emphasizes the importance of interfaces in the object-oriented model.
Chapter 8 considers operator overloading for classes, including overloading operators as either methods or top-level functions. This chapter abounds with examples to show how operators may be overloaded to advantage.
Storage is the topic of Chapter 9. Compile-time and run-time storage are discussed in detail, as are the main C++ storage classes: auto, static, and extern.
Chapter 10 shows how C++ supports generic functions through templates. This chapter also introduces STL (Standard Template Library) and offers short programs to illustrate STL containers, iterators, algorithms, and function objects.
In each of Chapters 1--10, several sections are devoted to sample applications. Each of these sections contains a statement of a problem, sample input and output, a solution to the problem, and a well-documented implementation of the problem in C++. Most of these sections conclude with an extended discussion. In some of the examples, these sections include a line-by-line discussion of the C++ program.
The sample applications include the following:
The C++ Postscript sections discuss less-used parts of the language and give additional technical details about certain parts of the language.
The Common Programming Errors sections highlight those aspects of the language that are easily misunderstood.
contains over 160 programming exercises drawn from a wide variety of applications.
The book contains over 350 numbered examples, which clarify particular facets of C++ for the reader and show the purpose of various C++ features. A box \outlinediamond\ marks the end of each example.
The book contains nearly 600 section review exercises, the answers to which are true or false, short answers, code segments, and, in a few cases, entire programs. These exercises are suitable as homework problems or as self-tests. The answers to the odd-numbered exercises are given in the back of the book, and the answers to the even-numbered exercises are given in the Instructor's Guide.
Class testing this book has convinced us of the importance of these exercises.
The applications covered in the programming exercises at the ends of the chapters include the following:
Not every reader will be interested in all of these applications; however, we think that it is important to show the variety of problems that C++ can address.
Five appendices are provided for reference. Appendix A contains the ASCII table. Appendix B explains the C++ preprocessor. Appendix C contains a list of some of the most useful C++ functions and class methods. We describe the parameters and return values for each, the header file to include, and what the function or method does. Appendix D covers run-time type identification (RTTI), and Appendix E covers exception handling.
Recent Language Changes
We have incorporated the latest changes to the C++ language including:
We use these new features throughout the book, but for those readers using older compilers, we also explain how to convert to the old-style C++.
Before the logical type was introduced, integer types were used for false (zero) and true (nonzero).
New-style headers drop the extension and prefix to the header files acquired from C. For example, the old C++ header file becomes, and the C header file becomes. Standard features furnished by these header files are now grouped under the name ( standard). The technical term for a region in which such features are grouped is namespace.
We thank the following reviewers: Ed Angel, University of New Mexico; Karen Bernstein, DePaul University; Ralph Ewton, University of Texas at El Paso; Mike Gearen, Punahou High School; Jeanine Ingber, University of New Mexico; and Bina Ramamurthy, SUNY at Buffalo. We are grateful to our friendly copy editor, Patricia Johnsonbaugh, for smoothing our prose and for deleting words and statements we drafted but should not have.
Our student, Wen Tao Liu, helped us check most of the major code segments.
We are indebted to the School of Computer Science, Telecommunications and Information Systems at DePaul University and its dean, Helmut Epp, for providing time and encouragement for the development of this book.
We received consistent support from the people at Prentice Hall. Special thanks go to Alan Apt, publisher, and Laura Steele, acquisitions editor.
(NOTE: Most chapters conclude with a C++ Postscript, Common Programming Errors, and Programming Exercises.)
0. Computer Systems and Program Development.
Problem Solving and Program Development.
1. Introduction to Data Types and Operators.
A First C++ Program.
The int Data Type.
Sample Application: Conversion of Lengths.
Other Integer Data Types.
Floating-Point Data Types.
Sample Application: A Math Puzzle.
Relational and Logical Operators.
2. Control Flow.
The tt if-tt else Statement.
Sample Application: Computing Taxes.
The while Statement.
Sample Application: Computing Taxes Revisited.
The do while Statement.
The for Statement.
Assignment, Increment, and Decrement Operators.
Sample Application: Statistical Measures.
The break, continue, and switch Statements.
Sample Application: Generating Prime Numbers.
Promotions and Casts.
Call by Value.
Sample Application: The Monty Hall Problem.
Call by Reference.
Sample Application: Printing a Calendar.
The Index Operator.
Arrays and Pointers.
Sample Application: Totaling Votes.
Arrays and Functions.
Sample Application: Merging Files.
Sample Application: Maintaining an Address Book.
Object-Oriented and Procedural Programming.
Classes and Objects.
Sample Application: A Clock Class.
Sample Application: A Time Stamp Class.
Constructors and the Destructor.
Sample Application: A Task Class.
Class Data Members and Methods.
Using Class Libraries.
Pointers to Objects and the Indirect Selection Operator.
Basic Concepts and Syntax.
Sample Application: Tracking Films.
Constructors and Destructors Under Inheritance.
Sample Application: A Sequence Hierarchy.
Run-Time versus Compile-Time Binding in C++.
Sample Application: Tracking Films Revisited.
Name Overloading, Name Overriding, and Name Hiding.
Abstract Base Classes.
8. Operator Overloading.
Basic Operator Overloading.
Sample Application: A Complex Number Class.
Operator Overloading Using Top-Level Functions.
Overloading the Input and Output Operators.
Overloading Some Special Operators.
Sample Application: An Associative Array.
Compile-Time and Run-Time Storage.
Storage Classes for Variables.
Pointers and Dynamic Storage.
Sample Application: Sorting and Searching.
Classes with Pointers as Data Members.
10. Templates and the Standard Template Library.
Sample Application: A Template Stack Class.
The Standard Template Library.
Sample Application: Stock Performance Reports.
A. ASCII Table.
B. The Preprocessor.
C. Selected C++ Functions and Methods.
D. Run-Time Type Identification.
E. Exception Handling.
Hints and Solutions to Odd-Numbered Exercises.
Get Free Shipping on orders over $25 (not including Rental and Marketplace). Order arrives in 5-10 business days.
Need it faster?
We offer fast, flat-rate expedited shipping options.
|Sell it back by:|
|Guaranteed cash back:|
|Cost of this book|
after cash back:
Take advantage of Guaranteed Cash Back. Send your book to us in good condition before the end of the buyback period, we'll send YOU a check, and you'll pay less for your textbooks!
When you're done with this book, sell it back to Textbooks.com. In addition to the best possible buyback price, you'll get an extra 10% cash back just for being a customer.
We buy good-condition used textbooks year 'round, 24/7. No matter where you bought it, Textbooks.com will buy your textbooks for the most cash.
Being online is not required for reading an eTextbook after successfully downloading it. You must only be connected to the Internet duringthe download process.
What is the Marketplace?
It's another way for you to get the right price on the books you need. We approved every Marketplace vendor to sell their books on Textbooks.com, so you know they're all reliable.
What are Marketplace shipping options?
Marketplace items do not qualify for free shipping. When ordering from the Marketplace, please specify whether you want the seller to send your book Standard ($3.99/item) or Express ($6.99/item). To get free shipping over $25, just order directly from Textbooks.com instead of through the Marketplace.
FREE UPS 2nd Day Air TermsRental and Marketplace items are excluded. Offer is valid from 1/21/2013 12:00PM to 1/23/2013 11:59AM CST. Your order must be placed by 12 Noon CST to be processed on the same day. Minimum order value is $100.00 excluding Rental and Marketplace items. To redeem this offer, select "FREE UPS 2ND DAY AIR" at checkout. Offer not is not valid on previous orders.