Book description
Dive into the essentials of C++ and algorithmic thinking with this book. This comprehensive guide is perfect for newcomers looking to build a strong foundation in programming and problemsolving.
Key Features
 Comprehensive introduction to C++ programming and detailed explanations of algorithmic concepts.
 Stepbystep setup of development environments, with practical exercises and realworld examples.
 Indepth coverage of control structures, and visual aids such as trace tables and flowcharts.
Book Description
Embark on your programming journey with a thorough introduction to how computers work, setting the stage for understanding C++ and its applications. This course begins with the basics, including setting up your development environment and installing necessary software packages. As you progress, you'll delve into fundamental algorithmic concepts, variables, constants, and handling input and output efficiently.
As you build your knowledge, the course introduces more complex topics such as sequence control structures, decisionmaking processes, and loop control structures. You will learn to manipulate numbers, strings, and understand the intricacies of operators through practical exercises and realworld examples. Visual aids like trace tables and flowcharts will help you visualize the flow of your programs and improve your debugging skills.
Towards the end of the course, you'll explore advanced topics such as arrays, data structures, subprograms, and an introduction to objectoriented programming. By the conclusion, you will also gain insights into file handling and advanced algorithmic strategies. Each chapter is designed to build on the previous one, ensuring a cohesive and comprehensive learning experience that equips you with the skills needed to excel in C++ programming and algorithmic thinking.
What you will learn
 Understand how computers and programming languages work.
 Master the basics of C++ and integrated development environments.
 Develop and debug algorithms effectively.
 Manipulate variables, constants, and data structures.
 Implement control structures to manage program flow.
 Create and use subprograms to optimize code.
Who this book is for
This course is designed for complete beginners with no prior programming experience, making it ideal for a wide range of learners. High school students, college students, and selftaught programmers will find this course particularly useful. It’s also suitable for professionals looking to transition into a programming role or enhance their technical skill set. Educators seeking a structured curriculum for teaching C++ can benefit from the course material. Basic computer literacy is recommended, but no prior knowledge of programming is required.
Table of contents
 Table of Contents
 Preface
 Part I Introductory Knowledge

Part II Getting Started with C++

Chapter 4 Introduction to Basic Algorithmic Concepts
 4.1 What is an Algorithm?
 4.2 The Algorithm for Making a Cup of Tea
 4.3 Properties of an Algorithm
 4.4 Okay About Algorithms. But What is a Computer Program Anyway?
 4.5 The Three Parties!
 4.6 The Three Main Stages Involved in Creating an Algorithm
 4.7 Flowcharts
 4.8 What are ”Reserved Words”?
 4.9 What is the Difference Between a Statement and a Command?
 4.10 What is Structured Programming?
 4.11 The Three Fundamental Control Structures
 4.12 Your First C++ Program
 4.13 What is the Difference Between a Syntax Error, a Logic Error, and a Runtime Error?
 4.14 What “Debugging” Means
 4.15 Commenting Your Code
 4.16 UserFriendly Programs
 4.17 Review Questions: True/False
 4.18 Review Questions: Multiple Choice

Chapter 5 Variables and Constants
 5.1 What is a Variable?
 5.2 What is a Constant?
 5.3 How Many Types of Variables and Constants Exist?
 5.4 Rules and Conventions for Naming Variables and Constants in C++
 5.5 What Does the Phrase “Declare a Variable” Mean?
 5.6 How to Declare Variables in C++
 5.7 How to Declare Constants in C++
 5.8 Review Questions: True/False
 5.9 Review Questions: Multiple Choice
 5.10 Review Exercises
 Chapter 6 Handling Input and Output
 Chapter 7 Operators
 Chapter 8 Trace Tables
 Chapter 9 Using Visual Studio Community or Visual Studio Code
 Review in “Getting Started with C++”

Chapter 4 Introduction to Basic Algorithmic Concepts

Part III Sequence Control Structures

Chapter 10 Introduction to Sequence Control Structures

10.1 What is the Sequence Control Structure?
 Exercise 10.11 Calculating the Area of a Rectangle
 Exercise 10.12 Calculating the Area of a Circle
 Exercise 10.13 Where is the Car? Calculating Distance Traveled
 Exercise 10.14 Kelvin to Fahrenheit
 Exercise 10.15 Calculating Sales Tax
 Exercise 10.16 Calculating a Sales Discount
 Exercise 10.17 Calculating a Sales Discount and Tax
 10.2 Review Exercises

10.1 What is the Sequence Control Structure?
 Chapter 11 Manipulating Numbers
 Chapter 12 Complex Mathematical Expressions
 Chapter 13 Exercises With a Quotient and a Remainder
 Chapter 14 Manipulating Strings
 Review in “Sequence Control Structures”

Chapter 10 Introduction to Sequence Control Structures

Part IV Decision Control Structures

Chapter 15 Making Questions
 15.1 Introduction
 15.2 What is a Boolean Expression?
 15.3 How to Write Simple Boolean Expressions
 15.4 Logical Operators and Complex Boolean Expressions
 15.5 Assigning the Result of a Boolean Expression to a Variable
 15.6 What is the Order of Precedence of Logical Operators?
 15.7 What is the Order of Precedence of Arithmetic, Comparison, and Logical Operators?
 15.8 How to Negate Boolean Expressions
 15.9 Review Questions: True/False
 15.10 Review Questions: Multiple Choice
 15.11 Review Exercises
 Chapter 16 The SingleAlternative Decision Structure
 Chapter 17 The DualAlternative Decision Structure
 Chapter 18 The MultipleAlternative Decision Structure
 Chapter 19 The Case Decision Structure
 Chapter 20 Nested Decision Control Structures
 Chapter 21 More about Flowcharts with Decision Control Structures

Chapter 22 Tips and Tricks with Decision Control Structures
 22.1 Introduction
 22.2 Choosing a Decision Control Structure
 22.3 Streamlining the Decision Control Structure
 22.4 Logical Operators – to Use, or not to Use: That is the Question!
 22.5 Merging Two or More SingleAlternative Decision Structures
 22.6 Replacing Two SingleAlternative Decision Structures with a DualAlternative One
 22.7 Put the Boolean Expressions Most Likely to be True First
 22.8 Why is Code Indentation so Important?
 22.9 Review Questions: True/False
 22.10 Review Questions: Multiple Choice
 22.11 Review Exercises

Chapter 23 More with Decision Control Structures

23.1 Simple Exercises with Decision Control Structures
 Exercise 23.11 Is it an Integer?
 Exercise 23.12 Validating Data Input and Finding Odd and Even Numbers
 Exercise 23.13 Where is the Tollkeeper?
 Exercise 23.14 The Most Scientific Calculator Ever!
 Exercise 23.15 Converting Gallons to Liters, and Vice Versa
 Exercise 23.16 Converting Gallons to Liters, and Vice Versa (with Data Validation)
 23.2 Finding Minimum and Maximum Values with Decision Control Structures
 23.3 Decision Control Structures in Solving Mathematical Problems

23.4 Exercises with Series of Consecutive Ranges of Values
 Exercise 23.41 Calculating the Discount
 Exercise 23.42 Validating Data Input and Calculating the Discount
 Exercise 23.43 Sending a Parcel
 Exercise 23.44 Finding the Values of y
 Exercise 23.45 Progressive Rates and Electricity Consumption
 Exercise 23.46 Progressive Rates and Text Messaging Services
 23.5 Exercises of a General Nature with Decision Control Structures
 23.6 Boolean Expressions Reference and Handy Tips
 23.7 Review Exercises

23.1 Simple Exercises with Decision Control Structures
 Review in “Decision Control Structures”

Chapter 15 Making Questions

Part V Loop Control Structures
 Chapter 24 Introduction to Loop Control Structures

Chapter 25 PreTest, MidTest and PostTest Loop Structures

25.1 The PreTest Loop Structure
 Exercise 25.11 Designing the Flowchart and Counting the Total Number of Iterations
 Exercise 25.12 Counting the Total Number of Iterations
 Exercise 25.13 Counting the Total Number of Iterations
 Exercise 25.14 Counting the Total Number of Iterations
 Exercise 25.15 Finding the Sum of Four Numbers
 Exercise 25.16 Finding the Sum of Odd Numbers
 Exercise 25.17 Finding the Sum of N Numbers
 Exercise 25.18 Finding the Sum of an Unknown Quantity of Numbers
 Exercise 25.19 Finding the Product of 20 Numbers

25.2 The PostTest Loop Structure
 Exercise 25.21 Designing the Flowchart and Counting the Total Number of Iterations
 Exercise 25.22 Counting the Total Number of Iterations
 Exercise 25.23 Designing the Flowchart and Counting the Total Number of Iterations
 Exercise 25.24 Counting the Total Number of Iterations
 Exercise 25.25 Finding the Product of N Numbers
 25.3 The MidTest Loop Structure
 25.4 Review Questions: True/False
 25.5 Review Questions: Multiple Choice
 25.6 Review Exercises

25.1 The PreTest Loop Structure

Chapter 26 Definite Loops

26.1 The for statement
 Exercise 26.11 Creating the Trace Table
 Exercise 26.12 Creating the Trace Table
 Exercise 26.13 Counting the Total Number of Iterations
 Exercise 26.14 Finding the Sum of Four Numbers
 Exercise 26.15 Finding the Square Roots from 0 to N
 Exercise 26.16 Finding the Sum of 1 + 2 + 3 + … + 100
 Exercise 26.17 Finding the Product of 2 × 4 × 6 × 8 × 10
 Exercise 26.18 Finding the Sum of 22 + 42 + 62 + … (2N)2
 Exercise 26.19 Finding the Sum of 33 + 66 + 99 + … (3N)3N
 Exercise 26.110 Finding the Average Value of Positive Numbers
 Exercise 26.111 Counting the Vowels
 26.2 Rules that Apply to ForLoops
 26.3 Review Questions: True/False
 26.4 Review Questions: Multiple Choice
 26.5 Review Exercises

26.1 The for statement
 Chapter 27 Nested Loop Control Structures
 Chapter 28 More about Flowcharts with Loop Control Structures

Chapter 29 Tips and Tricks with Loop Control Structures
 29.1 Introduction
 29.2 Choosing a Loop Control Structure
 29.3 The “Ultimate” Rule
 29.4 Breaking Out of a Loop
 29.5 Cleaning Out Your Loops
 29.6 Endless Loops and How to Stop Them
 29.7 The “From Inner to Outer” Method
 29.8 Review Questions: True/False
 29.9 Review Questions: Multiple Choice
 29.10 Review Exercises

Chapter 30 More with Loop Control Structures

30.1 Simple Exercises with Loop Control Structures
 Exercise 30.11 Counting the Numbers According to Which is Greater
 Exercise 30.12 Counting the Numbers According to Their Digits
 Exercise 30.13 How Many Numbers Fit in a Sum
 Exercise 30.14 Finding the Total Number of Positive Integers
 Exercise 30.15 Iterating as Many Times as the User Wishes
 Exercise 30.16 Finding the Sum of the Digits
 30.2 Exercises with Nested Loop Control Structures
 30.3 Data Validation with Loop Control Structures
 30.4 Finding Minimum and Maximum Values with Loop Control Structures

30.5 Using Loop Control Structures to Solve Mathematical Problems
 Exercise 30.51 Calculating the Area of as Many Triangles as the User Wishes
 Exercise 30.52 Finding x and y
 Exercise 30.53 The Russian Multiplication Algorithm
 Exercise 30.54 Finding the Number of Divisors
 Exercise 30.55 Is the Number a Prime?
 Exercise 30.56 Finding all Prime Numbers from 1 to N
 Exercise 30.57 Heron's Square Root
 Exercise 30.58 Calculating π
 Exercise 30.59 Approximating a Real with a Fraction
 30.6 Exercises of a General Nature with Loop Control Structures
 30.7 Review Questions: True/False
 30.8 Review Exercises

30.1 Simple Exercises with Loop Control Structures
 Review in “Loop Control Structures”

Part VI Data Structures in C++

Chapter 31 OneDimensional Arrays and Maps
 31.1 Introduction
 31.2 What is an Array?
 31.3 Creating OneDimensional Arrays in C++
 31.4 How to Get Values from a OneDimensional Array
 31.5 How to Alter the Value of an Array Element
 31.6 How to Iterate Through a OneDimensional Array

31.7 How to Add UserEntered Values to a OneDimensional Array
 Exercise 31.71 Displaying Words in Reverse Order
 Exercise 31.72 Displaying Positive Numbers in Reverse Order
 Exercise 31.73 Finding the Average Value
 Exercise 31.74 Displaying Reals Only
 Exercise 31.75 Displaying Elements with OddNumbered Indexes
 Exercise 31.76 Displaying Even Numbers in Odd–Numbered Index Positions
 31.8 What is a Map?
 31.9 Creating Unordered Maps in C++
 31.10 How to Get a Value from an Unordered Map
 31.11 How to Alter the Value of a Map Element
 31.12 How to Iterate Through a Map
 31.13 Review Questions: True/False
 31.14 Review Questions: Multiple Choice
 31.15 Review Exercises

Chapter 32 TwoDimensional Arrays
 32.1 Creating TwoDimensional Arrays in C++
 32.2 How to Get Values from TwoDimensional Arrays
 32.3 How to Iterate Through a TwoDimensional Array
 32.4 How to Add UserEntered Values to a TwoDimensional Array
 32.5 What's the Story on Variables i and j?
 32.6 Square Matrices
 32.7 Review Questions: True/False
 32.8 Review Questions: Multiple Choice
 32.9 Review Exercises

Chapter 33 Tips and Tricks with Data Structures
 33.1 Introduction
 33.2 Processing Each Row Individually
 33.3 Processing Each Column Individually
 33.4 How to Use More Than One Data Structures in a Program
 33.5 Creating a OneDimensional Array from a TwoDimensional Array
 33.6 Creating a TwoDimensional Array from a OneDimensional Array
 33.7 Useful Data Structures Functions/Methods (Subprograms)
 33.8 Review Questions: True/False
 33.9 Review Questions: Multiple Choice
 33.10 Review Exercises

Chapter 34 More with Data Structures

34.1 Simple Exercises with Arrays
 Exercise 34.11 Creating an Array that Contains the Average Values of its Neighboring Elements
 Exercise 34.12 Creating an Array with the Greatest Values
 Exercise 34.13 Merging OneDimensional Arrays
 Exercise 34.14 Creating Two Arrays – Separating Positive from Negative Values
 Exercise 34.15 Creating an Array with Those who Contain Digit 5
 34.2 Data Validation with Arrays

34.3 Finding Minimum and Maximum Values in Arrays
 Exercise 34.31 Which Depth is the Greatest?
 Exercise 34.32 Which Lake is the Deepest?
 Exercise 34.33 Which Lake, in Which Country, Having Which Average Area, is the Deepest?
 Exercise 34.34 Which Students Have got the Greatest Grade?
 Exercise 34.35 Finding the Minimum Value of a TwoDimensional Array
 Exercise 34.36 Finding the City with the Coldest Day
 Exercise 34.37 Finding the Minimum and the Maximum Value of Each Row

34.4 Sorting Arrays
 Exercise 34.41 The Bubble Sort Algorithm – Sorting OneDimensional Arrays with Numeric Values
 Exercise 34.42 Sorting OneDimensional Arrays with Alphanumeric Values
 Exercise 34.43 Sorting OneDimensional Arrays While Preserving the Relationship with a Second Array
 Exercise 34.44 Sorting Last and First Names
 Exercise 34.45 Sorting a TwoDimensional Array
 Exercise 34.46 The Modified Bubble Sort Algorithm – Sorting OneDimensional Arrays
 Exercise 34.47 The Selection Sort Algorithm – Sorting OneDimensional Arrays
 Exercise 34.48 Sorting OneDimensional Arrays While Preserving the Relationship with a Second Array
 Exercise 34.49 The Insertion Sort Algorithm – Sorting OneDimensional Arrays
 Exercise 34.410 The Three Worst Elapsed Times

34.5 Searching Elements in Data Structures
 Exercise 34.51 The Linear Search Algorithm – Searching in a OneDimensional Array that may Contain the Same Value Multiple Times
 Exercise 34.52 Display the Last Names of All Those People Who Have the Same First Name
 Exercise 34.53 The Linear Search Algorithm – Searching in a TwoDimensional Array that May Contain the Same Value Multiple Times
 Exercise 34.54 The Linear Search Algorithm – Searching in a OneDimensional Array that Contains Unique Values
 Exercise 34.55 Searching for a Social Security Number
 Exercise 34.56 The Linear Search Algorithm – Searching in a TwoDimensional Array that Contains Unique Values
 Exercise 34.57 Checking if a Value Exists in all Columns
 Exercise 34.58 The Binary Search Algorithm – Searching in a Sorted OneDimensional Array
 Exercise 34.59 Display all the Historical Events for a Country
 Exercise 34.510 Searching in Each Column of a TwoDimensional Array

34.6 Exercises of a General Nature with Data Structures
 Exercise 34.61 On Which Days was There a Possibility of Snow?
 Exercise 34.62 Was There Any Possibility of Snow?
 Exercise 34.63 In Which Cities was There a Possibility of Snow?
 Exercise 34.64 Display from Highest to Lowest Grades by Student, and in Alphabetical Order
 Exercise 34.65 Archery at the Summer Olympics
 Exercise 34.66 The Five Best Scorers
 Exercise 34.67 Counting the Frequency of Vowels
 34.7 Review Questions: True/False
 34.8 Review Exercises

34.1 Simple Exercises with Arrays
 Review in “Data Structures in C++”

Chapter 31 OneDimensional Arrays and Maps

Part VII Subprograms
 Chapter 35 Introduction to Subprograms

Chapter 36 UserDefined Subprograms
 36.1 Subprograms that Return a Value
 36.2 How to Make a Call to a Function
 36.3 Subprograms that Return no Values
 36.4 How to Make a Call to a void Function
 36.5 Formal and Actual Arguments
 36.6 How Does a Function Execute?
 36.7 How Does a void Function Execute?
 36.8 Review Questions: True/False
 36.9 Review Exercises

Chapter 37 Tips and Tricks with Subprograms
 37.1 Can Two Subprograms use Variables of the Same Name?
 37.2 Can a Subprogram Call Another Subprogram?
 37.3 Passing Arguments by Value and by Reference
 37.4 Passing and/or Returning an Array
 37.5 Default Argument Values (Optional Arguments)
 37.6 The Scope of a Variable
 37.7 Converting Parts of Code into Subprograms
 37.8 Recursion
 37.9 Review Questions: True/False
 37.10 Review Exercises
 Chapter 38 More with Subprograms
 Review in “Subprograms”

Part VIII ObjectOriented Programming

Chapter 39 Introduction to ObjectOriented Programming
 39.1 What is ObjectOriented Programming?
 39.2 Classes and Objects in C++
 39.3 The Constructor and the Keyword this
 39.4 Passing Initial Values to the Constructor
 39.5 Getter and Setter Methods
 39.6 Can a Method Call Another Method of the Same Class?
 39.7 Class Inheritance
 39.8 Review Questions: True/False
 39.9 Review Exercises
 Review in “ObjectOriented Programming”

Chapter 39 Introduction to ObjectOriented Programming

Part IX Files
 Chapter 40 Introduction to Files

Chapter 41 More with Files

41.1 Exercises of a General Nature with Files
 Exercise 41.11 Calculating the Sum of 10 Numbers
 Exercise 41.12 Calculating the Average Value of an Unknown Quantity of Numbers
 Exercise 41.13 Finding Minimum and Maximum Values
 Exercise 41.14 Concatenating Files
 Exercise 41.15 Searching in a File
 Exercise 41.16 Combining Files with Subprograms
 41.2 Review Exercises

41.1 Exercises of a General Nature with Files
 Review in “Files”
 Some Final Words from the Author
Product information
 Title: C++ and Algorithmic Thinking for the Complete Beginner
 Author(s):
 Release date: June 2024
 Publisher(s): Packt Publishing
 ISBN: 9781836208198
You might also like
book
C++ Crash Course
Upgrade your Code with C++ C++ is one of the most widely used languages for realworld …
book
The C++ Programming Language, 4th Edition
The new C++11 standard allows programmers to express ideas more clearly, simply, and directly, and to …
book
C++ Core Guidelines Explained: Best Practices for Modern C++
Write More Elegant C++ Programs “We are very pleased to see Rainer Grimm applying his teaching …
book
Modern C++ Programming Cookbook  Third Edition
Packed with practical recipes, explore the latest advancements in C++, optimize performance, and gain insights into …