DEV Community

Cover image for #1 Introduction: C++ and DSA
Bilal Sadiq
Bilal Sadiq

Posted on

#1 Introduction: C++ and DSA

Welcome to the exciting world of C++ programming! Whether you're a coding enthusiast or a newcomer to the realm of programming languages, C++ is a versatile and powerful language that has stood the test of time. In this blog post, we'll embark on a journey to explore the basics of C++, its history, and why it continues to be a go-to language for developers around the globe.

What is C++?

C++ is a general-purpose programming language that was created as an extension of the C programming language. Developed by Bjarne Stroustrup in the early 1980s, C++ was designed with the goal of adding object-oriented programming features to C, without sacrificing the efficiency and low-level access that C provided.

Features of C++

1. Object Oriented Programming (OOP) :
C++ supports the core principles of OOP, including
encapsulation, inheritance, and polymorphism. These features
allow developers to organize and structure their code in a
modular and reusable way.

2. Efficiency :
C++ provides low-level access to memory, making it suitable
for system-level programming and resource-constrained
environments. This level of control over memory makes C++ a
preferred choice for performance-critical applications.

3. Standard Template Library :
The STL is a treasure trove of pre-built classes and
functions that expedite development by providing generic
implementations of common algorithms and data structures.

4. Portability :
C++ programs can be compiled to run on different platforms
without modification. This portability makes it an excellent
choice for developing cross-platform applications.

Getting Started with C++

To start coding in C++, you'll need a compiler and an integrted
development environment. We'll be using Microsoft Visual
Studio Code.
You can download the VS Code from google by simply typing VS
Code download and by clicking the first link that appears after
search.

We'll be writing the first "Hello World!" program.
You need to create a file with extension .cpp and write the
following code :

Image description

After Writing the above code just simply hit run button on top
right corner and you will see the output as:

Image description

Congragulations! you have written your first program in C++.

Now let's talk about the program and it's structure :

The "#include using namespace std;" is the header
file you need to include in every C++ program.
Next is the function int main(), this is the main function, you
need to write your code in this main function.
We'll be discussing more about functions later.

Thanks,
Happy coding!

Top comments (0)