C++ Lesson 12: sizeof, typedef & escape sequences

 sizeof It is often helpful to know the amount of memory consumed by a variable or datatype. Using the SizeOf operator, you can get how much memory (in bytes) that a given variable has allocated. // The following data sizes are dependent on the CPU. cout << "The INT datatype...

C++ Lesson 11: Structures

Structures and enumerators in C++ are a datatypes that you create. This, similar to functions, allows grouping of related code. Structures can contain methods (functions) and members (variables) and allows for more flexibility. For example, say we wanted to create a structure to hold registration information for when a user wishes to register,...

C++ Lesson 10: Arrays

As you may remember from a lesson 3 – variables, a variable is a storage unit for a value or data. An array is very similar, in that it stores values or data but differs in the fact that it is multiple storage units. Why would we need a variable...

C++ Lesson 9 – Functions

Functions are a way of organizing execution. Instead of executing all of the program sequentially, we can chose to call sub-routines (also called methods, functions, procedures or sub-programs) that will execute code to perform a specific task. You may think of functions as a group of related code that will...

C++ Lesson 8 – Looping

Looping is the process of executing the same chunk of code. It may not sound useful at first, but you’ll find soon enough that it’s absolutely crucial. Take for example, what if we wanted to count to one hundred? We could do so using a procedural method and line up one hundred...