C++ L06 – Pointers

Pointers is one of the most important features of C++. It is a feature that is (purposely) missing from other popular object-oriented languages like Java and C#.

Pointers are a powerful thing. It gives you direct access to computer memory. However, with great power comes great responsibility, since a great chunk of programming errors in C++ are related to pointers.

In this post we are going to explore pointers and memory and update our game with new features.

Continue reading “C++ L06 – Pointers”

C++ L05 – Functions

Functions are pieces of code that do certain things based on given arguments. When writing programs, you will start to notice patterns in your code, things that you repeatedly do. Instead of copying and pasting code here and there, you simply wrap this code as a function and call that.

Not only this saves you a lot of typing, but imagine if for some reason you want to change a pattern (like a sneaky typo); you would have to go hunting for every instance. If instead, you have defined your reusable patterns as functions, you can change it once and work everywhere.
Continue reading “C++ L05 – Functions”

C++ L04 – Control structures

On this post we are going to start developing our first game. The game we will be writing is going to be an adventure with ASCII graphics, meaning that we will present our world using console output. On the posts that will follow we will expand on this game, divert it to something different and maybe even start using real graphics.

Our goal for this post, is to print a basic map and move our character using console input in the form of north-south-east-west [nsew].

Continue reading “C++ L04 – Control structures”

C++ L03 – Variables, types and operators

In order to be able to do something interesting and useful with C++, we have to take advantage of computer memory. The way we use computer memory is though variables.

On this post, I will show how you can define and use variables and apply operations on them.

Continue reading “C++ L03 – Variables, types and operators”

C++ L02 – Analyzing hello world

On the previous post we talked about setting up a C++ development environment. You should be able to compile and run C++ programs.

On this post we will be analyzing the previous hello world program in order to become familiar with some of the language features and artifacts. Don’t worry if you don’t understand everything that is mentioned here. Most of the terms discussed, are going to be posts of their own.

Continue reading “C++ L02 – Analyzing hello world”