This repository is an introductory to intermediate-level C++ "course", complete with lessons, code samples, exercises, challenges, and small games. Each folder in the repo comprises the relevant lesson, source code and learning material. Are you ready to dive into the deep blue C?
Whether you clone the repo or directly download the source code, you must generate a working project and environment out of the code and library files provided. You are advised to download and use CMake to do this. You may wish to use the CMake GUI app or build from the terminal, but whichever method you choose, the CMake source folder is the one you see above, with the CMakeLists.txt file within. Generate the project files into the destination folder of your choice, even if that's the same folder as the source folder. In terms of preferred IDE, mine is the industry-standard Visual Studio Community 2022, and with that in mind, the rest of my documentation will reference this IDE only.
Once CMake has created the build folder, open the solution via the DeepBlueC.sln file. Within Visual Studio, in the Solution Explorer, pick the project you want to build/run by right-clicking it and selecting Set as Startup Project. Now, build and run the project in either Debug or Release mode, which you can set in the toolbar above.
If the lessons and code I create is useful to you, and you'd like for me to create tons more, then consider sponsoring me.
In this very first lesson, you will be introduced to the C++ programming language, including where and why it is being used. You will also learn all about Visual Studio, where to download it and how to manage the IDE. Some tips and tricks will be covered to help you become more productive.
This lesson covers variables, fundamental data types, and contiguous blocks of memory known as arrays.
Here, you will discover all the many different operators that come with C++ and learn how to use them to manipulate your variables in memory.
In this lesson, you will learn how to branch your application based on different conditions and discover how to repeat commands using a particular loop.
Here, you will examine some special types of variables, namely pointers and references, and understand why they are so powerful and where and when they should or should not be used. You will also learn about stack and heap memory and how pointers can allocate space on either.
In this lesson, you will learn how to break all your code into manageable and reusable blocks of code, known as functions. You will learn the basics of regular functions, including how to pass data to and receive data from them, before discovering recursive functions, function overloading, and function pointers.
This lesson delves deeper into the entire pipeline of a working C++ program. From preprocessing to final execution, you will examine the different parts that work together to create an application. You will also learn about the Visual Studio project folder structure and debug and release modes.
Here, you will be introduced to Object-oriented programming and gain an overview of encapsulation. You will learn about classes and objects and how they are created and destroyed using constructors and destructors.
In this lesson, you will learn all about abstraction and how to create self-contained classes that do not need to expose their inner functionality to the outside world.
In the first part of this double feature, you will focus on containment, composition, and aggregation and discover how these can make one class consist of another, forming a 'has-a' relationship.
In this latter half, you will learn about inheritance and how child classes can derive from their parent classes, forming a special kind of ‘is-a’ relationship.
This lesson covers everything there is to know about polymorphism, including what it is, what it’s used for, and how to implement it properly. At the end of this lesson, you will know all about abstract base classes, early and late binding and dynamic casting. What a mouthful!
Here, you will learn all about operator overloading and how this powerful feature of C++ allows you to make your operators behave in very different ways, in ways that you want them to act.
In this lesson, you will discover how to create templatized classes and functions that act as a stencil for your codebase. This is another powerful language feature worthy of mention.
Here, you will learn about handy function objects called lambdas, which allow you to create blocks of reusable code to handle smaller and more complex tasks.
In this lesson, you are introduced to the C++ Standard Library and discover briefly what useful tools it offers the everyday programmer.
This lesson will cover the Standard Library's std::string class and detail exactly what the class has to offer.
Here, you will begin a brand new trilogy by learning all about the Standard Library's sequential storage units, namely, vectors, deques, and lists, including how they work and in what situation they would be helpful.
Your container journey unfolds as you discover associative containers, namely maps and sets, and learn what makes them valuable and where they would typically be implemented.
The container trilogy closes off with a dive into adaptive containers, namely stacks, queues, and priority queues.
In this lesson, you will discover another robust set of Standard Library tools: algorithms. You will learn what algorithms are, what they do, and how they can solve a particular problem.
This lesson covers unique, shared, and weak pointers.
Here, you will learn all about file handling, starting with reading from and writing to text files. You will investigate different file handling flags, stream operators, and file states.
The final chapter covers a look into binary files and how the internal file pointers can manage raw data in a file. You will both write binary data to and read data from a binary-formatted file so that you can store data in files that a user cannot edit.