About Lesson
C++ Introduction
In this tutorial, we will learn about Introduction, History, features & key-points, Applications and Compilers of C++.
C++ Introduction
- C++ is object-oriented programming language. It is an extension to C programming.
- C++ is a general purpose, case-sensitive programming language.
- It is portable and can be used to develop applications that can be adapted to multiple platforms.
- C++ is close to C# and java, it makes easier for programmers to switch to C++ or vice versa.
C++ History
- It is created by Bjarne Stroustrup and his team at Bell Laboratories in 1979. Forty years later, it is one of the most widely used language in the world.
- The name implies, C++ was derived from the C language; Bjarne’s goal was to add object-oriented programming into C.
- A language well-respected for its portability and low-level as well as high-level functionality.
- The language was updated 3 major times in 2011, 2014, and 2017 to C++11, C++14, and C++17.
C++ Features and Key-points
- Simple – It is a simple language in the sense that programs can be broken down into small parts, has a rich liberary support and a variety of data-types.
- Machine Independent but not Platform Dependent – C++ executable is not platform-independent (compiled programs on Linux won’t run on Windows), however it is machine independent.
- Middle-level Language – It is a Middle-level language, as we can do both systems-programming (drivers, kernels, networkinf etc.) and build large-scale user applications(Photoshop, Game Engines, Media Players etc.).
- Compiled Language – C++ is a compiled language, contributing to its speed.
- Faster execution – C++ programs excel in execution speed. Since, it is a compiled language, and also higely procedural.
Applications of C++
C++ finds varied usage in applications such as:
- Operating Systems & Systems Programming.(e.g. Linux-based OS Ubantu etc.)
- Programming Language Development.(e.g. C#, Java, Perl etc.)
- Browsers. (Chrome & Firefox)
- Database Engines. (MySQL, MongoDB, Redis etc.)
- Graphics & Game Engines. (Unreal-Engine, Blender, Photoshop etc.)
- Cloud/Distributed Systems.
C++ Compilers
There ara many C++ compilers available which you can use to compile and run :
- Apple C++. Xcode (Only supported by Apple OS.)
- Bloodshed Dev-C++
- Turbo C++
- MINGW – “Minimalist GNU for Windows”
- Code::Blocks
- Notepad++
In this tutorial, we will learn about Get Started, Syntax, and Basic Program of C++.
Get Started
To Start using C++, you need two things:
- A text-editor (like Notepad++, Code::Blocks and so on.), to write c++ code. Download Code::Blocks Text Editor
- A compiler, like GCC, to translate the C++ code into a language that the computer will understand.
There are many text editors and compilers available for C++.
C++ Install IDE
- An IDE (Intefrated Development Environment) is used to edit and Compile the code.
- Popular IDE’s include – Code::Blocks, Eclipse, and Visual Studio.
- These above mention IDE’s are Open Source and they can be used to edit and debug C++ code.
- We recommend Code::Blocks for practice our examples, which we believe is a good place to start coding.
C++ Quickstart
- Let’s create our First C++ file in Code::Blocks.
- Open Codeblocks and go to File > New > Empty File.
- Write the following C++ Code and save the file as myfirstprogram.cpp(File > Save File as):
// Your First C++ Program
#include <iostream>
int main() {
std::cout << "Hello World!";
return 0;
}
Output
Hello World!
Focus on how to run the code. and see the result of the above program.