C++ Programming: Program Design Including Data Structures 8th Edition
Designed for a first Computer Science (CS1 and CS2) C++ course, this text provides a breath of fresh air to you and your students. The CS1 and CS2 course serves as the cornerstone of the Computer Science curriculum. My primary goal is to motivate and excite all introductory programming students, regardless of their level. Motivation breeds excitement for learning. Motivation and excitement are critical factors that lead to the success of the programming student. This text is a culmination and development of my classroom notes throughout more than fifty semesters of teaching successful programming to Computer Science students. Warning: This text can be expected to create a serious reduction in the demand for programming help during your office hours. Other side effects include significantly diminished student dependency on others while learning to program.
C++ Programming: Program Design Including Data Structures started as a collection of brief examples, exercises, and lengthy programming examples to supplement the books that were in use at our university. It soon turned into a collection large enough to develop into a text. The approach taken in this book is, in fact, driven by the students’ demand for clarity and readability. The material was written and rewritten until the students felt comfortable with it. Most of the examples in this book resulted from student interaction in the classroom.
As with any profession, practice is essential. Cooking students practice their recipes. Budding violinists practice their scales. New programmers must practice solving problems and writing code. This is not a C++ cookbook. We do not simply list the C++ syntax followed by an example; we dissect the “why?” behind all the concepts. The crucial question of “why?” is answered for every topic when first introduced. This technique offers a bridge to learning C++ Students must understand the “why?” in order to be motivated to learn.
Traditionally, a C++ programming neophyte needed a working knowledge of another programming language. This book assumes no prior programming experience. However, some adequate mathematics background, such as college algebra, is required.
Changes in the Eighth Edition
The eighth edition contains more than 300 new and updated exercises, requiring new solutions, and more than 20 new programming exercises.
This edition also introduces C++14 digit separator (Chapter 3), C++11 class inline functions (Chapter 10), updated C++11 class data members initialization during declaration (Chapter 10), and C++11 random generators (Chapter 13). The C-string functions such as strcpy, strcmp, and strcat have been deprecated, and might give warning messages when used in a program. Furthermore, the functions strncpy and strncmp might not be implemented in all versions of C++ Therefore, in Chapter 13, we have modified the Programming Example newString to reflect these changes by including functions to copy a character array.
The programming language C++, which evolved from C, is no longer considered an industry-only language. Numerous colleges and universities use C++ for their first programming language course. C++ is a combination of structured programming and object-oriented programming, and this book addresses both types. This book is intended for a two-semester course, CS1 and CS2, in Computer Science. The first 10 or 11 chapters can be covered in the first course and the remaining in the second course.
In July 1998, ANSI/ISO Standard C++ was officially approved. This book focuses on ANSI/ ISO Standard C++. Even though the syntax of Standard C++ and ANSI/ISO Standard C++ is very similar, Chapter 7 discusses some of the features of ANSI/ISO Standard C++ that are not available in Standard C++.
Chapter 1 briefly reviews the history of computers and programming languages. The reader can quickly skim through this chapter and become familiar with some of the hardware components and the software parts of the computer. This chapter contains a section on processing a C++ program. This chapter also describes structured and object-oriented programming.
Chapter 2 discusses the basic elements of C++ After completing this chapter, students become familiar with the basics of C++ and are ready to write programs that are complicated enough to do some computations. Input/output is fundamental to any programming language. It is introduced early, in Chapter 3, and is covered in detail.
Chapters 4 and 5 introduce control structures to alter the sequential flow of execution. Chapter 6 studies user-defined functions. It is recommended that readers with no prior programming background spend extra time on Chapter 6. Several examples are provided to help readers understand the concepts of parameter passing and the scope of an identifier.
Chapter 7 discusses the user-defined simple data type (enumeration type), the namespace mechanism of ANSI/ISO Standard C++ and the string type. The earlier versions of C did not include the enumeration type. Enumeration types have very limited use; their main purpose is to make the program readable. This book is organized such that readers can skip the section on enumeration types during the first reading without experiencing any discontinuity, and then later go through this section.
Chapter 8 discusses arrays in detail. This chapter also discusses range-based for loops, a feature of C++11 Standard, and explains how to use them to process the elements of an array. Limitations of ranged-based for loops on arrays passed as parameters to functions are also discussed. Chapter 8 also discusses a sequential search algorithm and a selection sort algorithm. Chapter 9 introduces records (structs). The introduction of structs in this book is similar to C structs. This chapter is optional; it is not a prerequisite for any of the remaining chapters.
Chapter 10 begins the study of object-oriented programming (OOP) and introduces classes. The first half of this chapter shows how classes are defined and used in a program. The second half of the chapter introduces abstract data types (ADTs). The inline functions of a classes are introduced in this chapter. Also, the section “In-Class Initialization of Data Members and the Default Constructor” has been updated.
this chapter shows how classes in C++ are a natural way to implement ADTs. Chapter 11 continues with the fundamentals of object-oriented design (OOD) and OOP and discusses inheritance and composition. It explains how classes in C++ provide a natural mechanism for OOD and how C++ supports OOP. Chapter 11 also discusses how to find the objects in a given problem.
Chapter 12 studies pointers in detail. After introducing pointers and how to use them in a program, this chapter highlights the peculiarities of classes with pointer data members and how to avoid them. Moreover, this chapter discusses how to create and work with dynamic two-dimensional arrays, and also explains why ranged-based for loops cannot be used on dynamic arrays. Chapter 12 also discusses abstract classes and a type of polymorphism accomplished via virtual functions.
Chapter 13 continues the study of OOD and OOP. In particular, it studies polymorphism in C++. The chapter specifically discusses two types of polymorphism—overloading and templates. Moreover, C++11 random number generators are introduced in this chapter.
Chapter 14 discusses exception handling in detail. Chapter 15 introduces and discusses recursion. Moreover, this is a stand-alone chapter, so it can be studied anytime after Chapter 9.
Chapters 16 and 17 are devoted to the study of data structures. Discussed in detail are linked lists in Chapter 16 and stacks and queues in Chapter 17. The programming code developed in these chapters is generic. These chapters effectively use the fundamentals of OOD.
Chapter 18 discusses various searching and sorting algorithms. In addition to showing how these algorithms work, it also provides relevant analysis and results concerning the performance of the algorithms. The algorithm analysis allows the user to decide which algorithm to use in a particular application. This chapter also includes several sorting algorithms. The instructor can decide which algorithms to cover.
Chapter 19 provides an introduction to binary trees. Various traversal algorithms, as well as the basic properties of binary trees, are discussed and illustrated. Special binary trees, called binary search trees, are introduced. Searching, as well as item insertion and deletion from a binary search tree, are described and illustrated. Chapter 19 also discusses nonrecursive binary tree traversal algorithms. Furthermore, to enhance the flexibility of traversal algorithms, it shows how to construct and pass functions as parameters to other functions. This chapter also discusses AVL (height balanced) trees in detail. Because of text length considerations, discussion on AVL trees is provided as a separate section and is available on the website accompanying this book.
Graph algorithms are discussed in Chapter 20. After introducing the basic graph theory terminology, the representation of graphs in computer memory is discussed. This chapter also discusses graph traversal algorithms, the shortest path algorithm, and the minimal spanning tree algorithm. Topological sort is also discussed in this chapter and is available on the website accompanying this book.
C++ is equipped with a powerful library—the Standard Template Library (STL)— of data structures and algorithms that can be used effectively in a wide variety of applications. Chapter 21 describes the STL in detail. After introducing the three basic components of the STL, it shows how sequence containers are used in a program. Special containers, such as stacks and queues, are also discussed. The latter half of this chapter shows how various STL algorithms can be used in a program. This chapter is fairly long; depending on the availability of time, the instructor can at least cover the sequence containers, iterators, the classes stack and queue, and certain algorithms.
|Download Ebook||Read Now||File Type||Upload Date|
|April 23, 2019|
Do you like this book? Please share with your friends, let's read it !! :)How to Read and Open File Type for PC ?