Chapter I - Intro to Programming
Intro:
I'm making this because I'm on my 4th semester of C++ at my university. So, I figured I'd teach some of you the basics of what I know. This will be extremely in-depth and will feature quite a bit of C++ terminology.
What is C++?
It is based of the C language and offers object-oriented features not found in C.
Reasons C++ is useful
C++ is popular because of it's low-level mixtures obtained from C as well as it's high-level features. C++ can also be written on one type of computer and then ran on many other systems. (It will need to be recompiled, but it's essentially the same)
How it works
After you have written a C++ code, it enters the process of converting it to machine language. It begins by going through a preprocessor which reads the code. (This is where special lines of code are used, I.E. #include, #windows.h, etc.) After the code is modified, the compiler goes through the preprocessed code and translates it into machine language. (This is where syntax errors, wrongful use of operators and other problems arise). If everything checks out okay, the compiler stores the machine code, otherwise known as object code, into an object file.
Visual Representation
Writing Your First Source Code
Since this is the beginning of C++, we will start out with simple C++ console code.
Although the source is valid and produces no errors, notice how it looks terrible and hard to read? Well this is where we each have our own style of writing. For every person, the style of writing differs. However, it doesn't really matter how you write it unless you're doing a job in which other people will need to see and read your source code.
Below is an example of how I would write this same code.
When writing C++, spacing does not matter. The compiler basically ignores any white space unless quoted.
Now, to make the output look a bit more presentable, let's play with the code we've already written.
Don't like reading? Watch the video below!!
Oh and I'm sick at the moment, so excuse whatever mistakes I make/my voice.