Home C++ Programming Tutorials Introduction to C++

Introduction to C++

by anupmaurya

What is C++?

C++ is a powerful general-purpose programming language. It can be used to develop operating systems, browsers, games, and so on. C++ supports object-oriented, procedural, and generic programming. This makes C++ powerful as well as flexible.

C++ is a middle-level language, as it encapsulates both high and low level language features.

C++ History

  • C++ programming language was developed in 1980 by Bjarne Stroustrup at bell laboratories of AT&T (American Telephone & Telegraph), located in U.S.A.
Bjarne Stroustrup founder of C++ Language
Bjarne Stroustrup founder of C++ Language
  • Bjarne Stroustrup is known as the founder of C++ language.
  • It was develop for adding a feature of OOP (Object Oriented Programming) in C without significantly changing the C component.
  • C++ programming is “relative” (called a superset) of C, it means any valid C program is also a valid C++ program.

Object-Oriented Programming (OOPs)

C++ supports object-oriented programming, the four major pillar of object-oriented programming (OPPs) used in C++ are:

  1. Inheritance
  2. Polymorphism
  3. Encapsulation
  4. Abstraction

C++ Standard Libraries

Standard C++ programming is divided into three important parts:

  • The core library includes the data types, variables and literals, etc.
  • The standard library includes the set of functions manipulating strings, files, etc.
  • The Standard Template Library (STL) includes the set of methods manipulating a data structure.

Application of C++

By the help of C++ programming language, we can develop different types of secured and robust applications:

  • Window application
  • Client-Server application
  • Device drivers
  • Embedded firmware etc

C++ Hello World Program

Let’s have look on a simple C++ program to Print “Welcome to C++” message to the console.

#include <iostream>  
using namespace std;  
int main() {  
   cout << "Welcome to C++";  
   return 0;  

Let’s go through it line by line:

  1. #include <iostream>: This line tells the compiler to include a header file called <iostream>. This file contains definitions for input and output operations in C++, which we’ll use to print the message.
  2. using namespace std;: This line tells the compiler to use the std namespace, which contains common C++ objects like cout (used for output) and cin (used for input). It’s a convenience so we don’t have to write std::cout every time.
  3. int main() {: This line defines the main function, which is the entry point of the program. When you run the program, this function is the first one that gets executed. The int part indicates that the function will return an integer value (in this case, 0 to signal successful execution).
  4. cout << "Welcome to C++";: This line uses the cout object from the std namespace to print the message “Welcome to C++” to the console (usually the command prompt or terminal window where you run the program). The << operator is the insertion operator, which is used to send data to cout.
  5. return 0;: This line returns the value 0 from the main function, indicating that the program has executed successfully.

You may also like

Adblock Detected

Please support us by disabling your AdBlocker extension from your browsers for our website.