A BEGINNERS INTRODUCTION TO C++: HISTORY, BASIC PROGRAM STRUCTURE, LEARNING TIPS, AND RESOURCES
Like most engineering colleges, mine also has C++ added to our curriculum, and since I’ve been a C++ developer for close to a year now, I thought it’d be cool if I wrote an article on the language especially for those who think C++ and programming are uphill and only for the geeks.
C++ has been a household name in the tech space as one of the most popular and most used languages notable for its speed and object-oriented properties. C++ is a high-level language developed from the C programming language at Bell Labs by Bjarne Stroustrup in 1985. Today, used for the development of multipurpose high-performance applications. In some way, we all have interacted with programs written in C++. Here is a couple of cool stuff built using the C++ programming language
Thief System Shock 2 Thief II (Game)
Resident Evil 6 (Game)
Dogecoin (Cryptocurrency)
Bitcoin (Cryptocurrency)
Google Assistant (AI assistant)
Direct X (Game Engine)
Unity (Game Engine)
So, you’ve been interacting with C++-based programs without being aware.
Learning C++ is in no way, a waste of time as its applications are numerous. Popular Uses and implementations of the C++ programming language are.
USES OF C++
Game development
Blockchain development
Cybersecurity
Operating systems development
Robotics
Browser Development
Artificial Intelligence
Computer Vision
web browser development e.t.c
C++ is quite very powerful if you ask me and its diverse uses send the message.
WHERE TO LEARN C++
Here’s a couple of cool websites and youtube channels where you can learn to write and develop software with C++
Websites
Sololearn.com (Recommended)
Programiz.com (Recommended)
Codecademy.com
Youtube Channels
The Cherno (Recommended)
The C++ DEVELOPMENT ENVIRONMENT
Just like we write human languages on paper, C++ codes are written in an IDE (Integrated Development Environment) which is a computer program that contains a debugger, syntax editor, build tools, and a compiler that translates lines of code into machine code using an assembler. Popular C++ IDEs include
Codeblocks
Dev C++
Codelite
Jetbrains CLion (Recommended)
Microsoft Visual Studio
Some text editors like Sublime text, Visual studio code, and Atom also have good tools for C++ development.
A BASIC C++ PROGRAM (Outputting Hello World)
Here’s a pretty basic tutorial where I will be illustrating how to output the conventional text “Hello World”.
A program that Outputs Hello World in C++ looks like this
#include <iostream>
using namespace std;
int main(){cout << "Hello world";return 0;}
Here’s a line by line explanation
Line 1: #include is a preprocessor directive. It tells the compiler to include the C++ header files. iostream is the header file that contains the input and output functions. header file names are usually contained in the <>
Line 2: std here means standard. we are basically telling the compiler that we want to use everything in the C++ standard namespace (types, functions, variables)
Line 3: Every C++ program starts running from the main function. The braces signify the start and stop of the function
Line 4: Here we Output the text. cout which means console out is a function for output and the double less than symbol (<<) is called the stream insertion operator and is used for outputs.
NOTE: Every C++ line of code must end with a semicolon “;”
line 5: return 0 runs to show a successful code compilation
And there we have it, the most basic C++ program.
Knowledge of C++ opens the developer to a whole world of opportunities so have fun learning.