Teaching modern C++ doesn't have to be difficult. Murach's C++ Programming helps you guide your students step-by-step, from the basics of programming to best practices for OOP to how to work with legacy code. Every chapter is carefully laid out so that by the time your students are done, not only will they have a solid foundation, but they'll also understand each concept and piece of code and be capable programmers in their own right.
Putting together a complete, effective course doesn't need to be time-consuming. In addition to the book, we provide all of the materials you need to quickly create a course. You can easily customize the provided slides, projects, and tests to suit your teaching style. What’s more, each project and line of code has been thoroughly tested to make sure you’re teaching code that “actually works!”
The Canvas course file contains all the objectives, quizzes, projects, case studies, and PowerPoint slides that you need to run an effective course. It only takes a few clicks to import it into the Canvas LMS. Then, you can customize it for your course. Learn more.
I am taking an object-oriented C++ course at a community college, and this book helps tremendously because it is skill-based, the most important selling point for beginners.”
To make this book as effective as possible for you, the content is divided into four sections.
We’ve designed this book to help you teach your students C++ as quickly and effectively as possible. Here are a few of the ways it does that:
Because today’s programmers typically use IDEs to save time and quickly find errors, that’s how we present C++ coding in this book.
The two IDEs we specifically cover are Visual Studio with its Microsoft Visual C++ (MSVC) compiler for Windows and Xcode with the open-source Clang compiler for macOS. The appendixes show how to install the IDEs, chapter 1 gives a quick tutorial in using them, and chapter 8 covers tips for debugging within them.
However, you can use any IDE you want; the principles will be the same though the installation and user details will differ. Or, if you don’t want to use an IDE, you can use a text editor and a command line.
“I have four other C++ books and this is by far the best one. Highly recommended.”
- Posted at an online bookseller
“I am taking an object-oriented C++ course at a community college, and this book helps tremendously because it is skill-based, the most important selling point for beginners.”
- Posted at an online bookseller
“As a long-time trainer and developer in other languages, I thought of C++ as being an unnecessarily complex language that wouldn’t help me with the applications I needed to create. Murach has created a C++ book that eased my concerns. I enthusiastically endorse this book.”
- Don Sheehan, Technical Trainer
“Murach's book did an excellent job explaining today’s C++, using simple yet meaningful code examples.”
- Posted at an online bookseller
“As a beginner in programming, I spent many frustrated months trying to learn C++ programming using several books, including both of Bjarne Stroustrup's books. None of them were clear and did not help me to reach the level I wanted to achieve. I bought your book, Murach's C++ Programming, and within days I was able to understand all the things I previously could not.”
- Thomas B. Wills
“Excellent. Everything taught is illustrated in examples, exercises and sample programs.”
- Posted at an online bookseller
“I bought this book to help tutor my daughter in a college C++ class she is taking. I was very impressed with how the book is laid out and how instructive it is. The two-page layout makes it extremely easy to grasp the concepts and visualize the code as you are learning it.”
- Posted at an online bookseller
“I wish more programming books were written / thought-out as well as this one.”
- Posted at an online bookseller
View the table of contents for this book in a PDF: Table of Contents (PDF)
Click on any chapter title to display or hide its content.
Four general-purpose programming languages
A brief history of C++
The user interface for a console application
The source code for a console application
How source code compiles to an executable file
Four popular IDEs and compilers
How to open a project and work with source code
How to compile and run a project
How to use code completion and error detection
How to create a new project
How to open a project and work with source code
How to compile and run a project
How to use code completion and error detection
How to create a new project
How to code statements
How to code comments
How to code a main() function
How to create identifiers
How to define and initialize variables
How to code assignment statements
How to code arithmetic expressions
How to include header files
How to write output to the console
How to read input from the console
The Gallons to Liters program
How to call a function
How to work with the std namespace
The Circle Calculator program
How to generate random numbers
How to assign values to char and string variables
How to work with special characters
How to read strings and chars from the console
How to fix a common problem with reading strings
The Guest Book program
How to test a program
How to debug a program
How to use the relational operators
How to code an if statement
How to work with braces
The Invoice 1.0 program
How to use the logical operators
If statements that use the logical operators
How to code nested if statements
The Invoice 2.0 program
How to use the conditional operator
How to code switch statements
More examples of switch statements
A switch statement for the Invoice 2.0 program
How to use arithmetic unary operators
How to use the compound assignment operators
How to work with the order of precedence
How to code while loops
More examples of while loops
How to code do-while loops
The Test Scores program
How to code for loops
The Future Value program
How to code nested loops
How to code break statements
How to code continue statements
The Guess the Number program
An introduction to streams and buffers
How unexpected input can cause problems
How to discard data from an input stream
How to detect data input errors
How to handle data input errors
An introduction to stream manipulators
How to specify the width of a column
How to right or left justify columns
How to format floating-point numbers
The Invoice 3.0 program
How to read and write a file
How to append data to a file
How to use the fstream object to work with files
How to check for errors when working with files
How to write delimited data
How to read delimited data
The Temperature Manager program
How to use a string stream to handle unexpected data
The Temperature Analyzer program
The fundamental data types
How to define and initialize variables
How to define and initialize constants
The Light Years Calculator program
How to work with type conversion
How to convert between numbers and strings
How to work with data type sizes and limits
How to fix problems with floating-point data
How to create a vector and refer to its elements
How to initialize and loop through a vector
How to use member functions of a vector
The Test Scores program
The Temperature Manager program
How to create and loop through a string
How to use basic member functions of a string
How to search a string
How to work with substrings
How to modify a string
How to check characters within a string
The Create Account program
The Word Jumble program
How to define and call a function
The Miles Per Gallon program
How to declare a function
When and how to use local and global variables
How to use a hierarchy chart
The Convert Temperatures program
How to use default values for arguments
How to overload a function
How to use reference variables as parameters
How to use reference parameters to improve efficiency
The Temperature Manager program
How to create, implement, and use header files
How to define namespaces
A header for getting input from the console
The Future Value program
Typical test phases
The three types of errors
Common C++ errors
How to plan the test runs
A simple way to trace code execution
How to set and remove breakpoints
How to step through code
How to inspect variables
How to inspect the stack trace
How to set and remove breakpoints
How to step through code
How to inspect variables
How to inspect the stack trace
How to deploy a program
How to run a deployed program
How to get started with structures
How to initialize a structure
The Movie List 1.0 program
How to nest structures
How to use structures with functions
How to compare structures for equality
How to work with member functions
How to work with member operators
The Movie List 2.0 program
Basic skills for working with scoped enumerations
More skills for working with scoped enumerations
How to work with unscoped enumerations
The Monthly Bonus Calculator program
How to create an array and access its elements
How to initialize an array
How to loop through an array
How to pass an array to a function
How to compare and copy arrays
The Test Scores program
An introduction to C strings
How to use C strings with input streams
Some utility functions for working with C strings
How to loop through a C string
The Create Account program
How to search an array
How to sort an array
How to work with a two-dimensional array
How to pass a two-dimensional array to a function
The Top Five program
A function that doesn’t use exceptions
How to throw an exception
How to catch an exception
A program that catches exceptions
A program that prevents exceptions from being thrown
How to catch multiple exceptions
How to rethrow an exception
The Temperature Manager program
How to work with custom exceptions
How exception handling works
A Movie structure that doesn’t provide encapsulation
A Movie class that provides encapsulation
How to define private data members
How to define getter and setter functions
The Movie List 1.0 program
How to work with private member functions
How to overload a setter function
How to define constructors
How to define destructors
The header and source files for a Movie class
When and how to use inline functions
The Movie List 2.0 program
An introduction to UML diagrams
UML diagrams with data types
A Product class that implements a UML diagram
The Product Viewer program
A Die class
A Dice class
The Dice Roller program
The console
The code
How inheritance works
How to define a superclass
How to define a subclass
How to define another subclass
How polymorphism works
The Product Viewer program
How to define an abstract class
How to control overriding
How multiple inheritance works
The DayReader superclass
The DayWriter superclass
The DayIO subclass
Code that uses the DayIO subclass
How to use inheritance with custom exceptions
Guidelines for using inheritance
How to code static data members and functions
How to access static data members and functions
The Console class
Code that uses the Console class
The FuelTank class
A friend function that works with two classes
How to overload arithmetic binary operators
How to overload arithmetic unary operators
How to overload relational operators
How to overload the insertion and extraction operators
How to work with a module that exports a function
How to work with a module that exports namespaces
How to work with a module that exports classes
How to use the export keyword for access control
How to use the import keyword
A summary of STL containers
A summary of STL iterators
Basic skills for working with iterators
Member functions shared by the STL containers
How to iterate the data in a container
Member functions shared by the sequence containers
Member functions of a vector
How to set capacity to improve efficiency
The Movie Rankings 1.0 program
Basic skills for working with arrays
How to pass an array to a function
An introduction to lists and forward lists
Member functions of a list
The Movie Rankings 2.0 program
How to work with queues
How to work with stacks
Member functions of associative containers
Code examples that work with sets
Member functions and operators of a map
How to insert key/value pairs and work with values by key
The Word Counter program
How to work with a vector of vectors
How to work with a map of vectors
The relationship between containers, iterators, and algorithms
How to call an algorithm
How to pass a function as an argument
How to use non-modifying algorithms
How to use modifying algorithms
How to use the min and max algorithms
How to use the numeric algorithms
How to use the sort and binary search algorithms
The Number Cruncher program
How to use algorithms with intervals of key/value pairs
How to use algorithms with nested containers
How to work with function templates
How to work with function objects
How to work with lambda expressions
The Uptime Percentage program
How physical memory works
How to define and use pointers
More skills for defining and using pointers
How pointer variables compare to reference variables
How and when to pass pointers to functions
How to use the this pointer in a member function
The Step Counter 1.0 program
The Step Counter 2.0 program
An overview of the types of storage
How to allocate and deallocate free store memory
How to use RAII (Resource Acquisition Is Instantiation)
How to implement the Rule of Three with RAII
How to implement the Rule of Five with RAII
How to work with smart pointers
The Sensor Analysis program
How to compare pointers
How to use pointer arithmetic
How to work with void pointers
How to use pointers with inheritance
How complex compound types work
An overloaded function
A function template
How to code a function template with one type parameter
How to code a function template with multiple type parameters
How to code a simple class template
How to code a more complex class template
How to use a complex class template
How to code a function template that works with a class template
The Sensor Analysis program
How to work with member types
The MyVector class declaration
The constructor and destructor definitions
The assignment operator definitions
The member function definitions
The Task Manager 1.0 program
How to work with iterator traits
The Link structure
The MyIterator class
The MyList class declaration
The destructor definition
The member function definitions
The Task Manager 2.0 program
The find_midpoint() algorithm
The Number Cruncher program
How to install the Visual Studio IDE
How to install the source code for this book
How to install the Xcode IDE
How to install the source code for this book
Our instructor’s materials include everything you need for a complete and highly effective C++ course, whether you’re teaching an introduction to programming course, C++ as a second (or fourth or nth language), or a weekend extension course.
These materials include the specs, starting files, and solutions for projects and case studies; test banks; complete sets of PowerPoint slides; and more. A complete breakdown of everything we’ve included and why is available in our detailed Instructor’s Summary, but you can see the highlights below.
Taken together, these materials allow students to practice more…and learn more!…in much less time.
The complete set of instructor’s materials described in the Instructor’s Summary can be downloaded from your instructor account page once you’ve submitted your request and we’ve approved it. The download is a .zip file.
If you use Canvas as your LMS, we’ve created a complete Canvas course for the book, using selected materials from our full set of instructor’s materials. This makes it easy for you to evaluate the components and see how they work together in a complete course. Again, if you request this file, it will be available to download from your instructor account page. It’s an .ismcc file.
This is the first Canvas course file we’ve created, so we’d really appreciate your feedback on it. Is it easy to install? Is there anything missing or unnecessary? What improvements can we make? Please let us know. Thank you!
On this page, we’ll be posting answers to the questions that come up most often about our C++ book. So if you have any questions that you haven’t found answered here at our site, please email us. Thanks!
While we strive to make sure our books are as error-free as possible, we are aware that typos may creep in. So if you find any errors, we want to know. Please email us, and corrections that affect the technical accuracy of the book will be posted here. Thank you!
This is our site for college instructors. To buy Murach books, please visit our retail site.