Introduction

0 issacprowse1308 November 13, 2020

C++ is a powerful general-purpose programming language developed by Bjarne Stroustrup as an extension of C Programming Language. It is mainly using to developing operating systems, browsers games, and so on.

When I am sying general-purposeIt simply means that It is using for developing applications in a wide variety.

History of C++:

The idea of the C++ programming language starts in 1979 when Bjarne Stroustrup working in a Ph.D. thesis. During this time, he is working with another programming language called Simula.

He thinks to implement Object-oriented programming language in the software development field. So, he started working with classes i.e he is working for new programming languages that have an object-oriented paradigm with the feature of the C Programming language.

In 1983, New programming is introduced with extra features such as classes, inheritance, in-lining, polymorphism, encapsulation, and many more named C++. It is commercially released in 1985.

C++ History Timeline

C++ History Timeline From 1979 to Till
C++ History Timeline From 1979 to Till

Feature  of C++:

As we know, C++ is the upgrade version of the C Programming language. The main intention of developing the C++ programming is to add an object-oriented feature in the C programming language. Not only the OOPS concepts, but C++ also has many other features that we will explain here.

  • Object-Oriented: The main up-gradation of the C Program is to add Object-oriented features. It supports the feature of OOPS such as Abstraction, Inheritance, Encapsulation, and Inheritance. This feature helps programmers to code in an easier way.
  • Memory Management: C++ Programming Language supports dynamic memory allocation. You can easily manage to allocate memory also free them. Not only this, but C++ also provides dynamic memory management techniques.
  • Powerful and fast: C++ is powerful and fast because its compilation and execution time is less.
  • Middle-Level Programming Langauge: C++ is a middle-level programming language that has the ability to de both low-level and high-level programming.
  • Structured Programming Langauge: We have many functions and classes in c++ that helps the programmer to break a problem into a block of code and structure that improves code readability and reusability.
  • Rich Library: C++ Programming has many built-in functions that the programmer can access while coding. This helps the programmer in developing fast. 

Hello World – First C++ Program

Here, We will write a simple program that will display Hello World message. We will discuss each part in detail.

#include <iostream>
using namespace std;

int main(){
    
    // This is the single comment

    /*  This
     *       is
     *         multiple comment
     */

      cout << "Hello World" << endl;
    
    return 0;
}

The output of the above program is:

Hello World

Let’s discuss all the lines of the above program in detail.

1. Comments

Here we can see two types of comments in the above program. Comments are the explanation or description of source code that does not affect your program logic in any way. Comments are neglected by compilers or interpreters.

// This is single line comments

/*
*    This
*        is
*          the multiple line comment.
*/

2. #include <iostream>

This statement tells the compiler to include iostreamfile from the library. This library contains input-output functions such as coutcin, etc.

3. using namespace std

The namespaceis a region that provides scope to an identifier (functions, variables, and name od the types). Here we have used std as namespacethat tells compiler to look into particular region of identifiers. I will not discuss this topic in details here beacause that may confuse you. We will learn this in details in next chapter with examples that helps you to make clear concept on namespace.

4. init main()

This is the mainfunction of our program from where the program start to execute. intmeans the return type of that function which tells the compiler that this function return integer type value.

5. cout << “Hello World” << endl

coutis an object that is presented in iostrem class. The objective of this is to print the statement as a output. This object print inside the value include in double quote (“”) and it also can display variable values. 

endlis an object of iostremclass which is used to print new line character.

6. return 0

This statement return 0 value from main function which state that execution is completed. return 1 state that execution is failed.

How to Learn C++?

  • Code Help Pro Tutorials: You can learn C++ Programming using our free tutorials, projects, and examples.
  • Official Documentation: You can use official documentation to learn C++ Programming.
  • Write Code: Most effective way to learn programming is to write a lot of code. Check out C++ Examples on Code Help Pro.