The Coronavirus lockdown here in the UK is starting to ease, but it still means a lot of time at home. I’m trying to use that time to be more productive and learn more, which has lead me to C++.

## C++

C++ has a long history (going back to 1985) and is a high level programming language. It was created by Bjarne Stroustrup and is an extension of the programming language C. C++ looks to have a new version every three years. Wikipedia’s C++ page has more details.

## Why C++

Depending on the source, C++ is (at time of writing) one of the top five programming languages to know. I have already got some experience with Python, Java and C, so I thought it was time to learn a bit about C++.

For this learning I have started with Microsoft’s Introduction To C++ via EdX and No Starch Press’ C++ Crash Course (written by Joshua Lospinoso). I’m hoping to use my blog to make notes about C++ that I may need in future, starting with the basic data types and operators.

## Basic Data Types

This is a small sample of some of the data types available in C++ but should be enough for me starting out. *char* is a single character, and multiple characters are a string.

## Operators

C++ comes with several operators already defined, these include the basic mathematical operators such as:

+ addition e.g. x+y - subtraction e.g. x-y * multiplication e.g. x*y / division e.g. x/y % modulo e.g. x%y

The short hand mathematical operators:

+= e.g. x+=y which would be the same as x=x+y -= e.g. x-=y which would be the same as x=x-y *= e.g. x*=y which would be the same as x=x*y ++ increase by 1 -- decrease by 1

The comparison operators:

== equal to != not equal to > greater than >= greater than or equal to < less than <= less than or equal to

The logic operators:

&& logical AND || logical OR ! logical NOT

## 2 thoughts on “Learning C++, Basic Data Types and Operators (C++)”

Comments are closed.