A Brief introduction about C++

Before starting Programming in C++, we will discuss some following topics here,

about C++

C++ is an object oriented programming language. Which was developed by Bjarne stroustrup in 1983 in AT & Bell Laboratories. Although the C language was already present, but the size of the program in C was not going to be easier to manage. In such a situation a need of a new language was felt. Because C ++ was the only updated version of C and it was added to class only as new features, so it was first named C with Class. Which was later changed to C ++ in 1983.

Only OOPs are different in C ++ and C, so if either one of these two languages is understood, then the other language will also be easily understood.

Because C ++ is an updated version of C itself. So it supports all the features of C as well as supports OOPs. If a software or program is built in C, then it can be made better in C ++. It is also called hybrid language due to the inclusion of two programming languages (C and C ++) in it.

C++ is a system independent language, i.e. it can be easily executed in Windows, Linux, Mac. Due to being a powerful feature like Pointer, you can easily create memory allocation related programs from it.

The main feature of C ++ is the following which separates it from C.

Because this tutorial has been created for Beginners who have never worked on C language, we will be learning this advanced features of C ++ in the same tutorial.

before starting programming in C++, is really useful nowadays,

 

Use of C++

C++ is used from system software (like Windows, Linux, mobile operating system) to application software (e.g., Photoshop, coral-draw, Microsoft office).

C++ language is also used in creating high-use graphics software such as gaming, animation, motion graphics, virtual reality device.

C++ provides speed, so it is used by web browsers like – Google chrome, Mozilla Firefox, internet explorer, Opera mini etc.

Compiler of other programming languages ​​like Java, C, C # etc has been written mostly in C++ language.

Due to being a C++ secure language, it is used to manage a large database in the server side such as Google, Facebook, Yahoo etc.

widely used MySQL (also built in C++ language) is used to access a database. Which provides the user with fast accessing from a database.

Along with creating media player, C++ is also used to manage media files. Also, C++ is used in online streaming audio and video. Like YouTube, internet radio, television broadcast etc.

C++ is also used in system programming (in low level) which controls any hardware. Such as Robotics, router, system driver, networking switch etc. In.

Other use – engineering application such as CAD / CAM system, MRI machine (used in medical), visual effects, mobile sensor, smartwatch, gaming tools, multitask operation, image processing, application, financial system, flight simulator, radar cloud storage, content management system, call center, payment processing, web server, application server etc.

C++ is the base of OOPs type programming languages, as most of all advanced programming language features are derived from C++. If you have good skills in C++, then you can easily learn other programming languages like Java, php, android, so according me, you must take a look at C++ before learning other languages. This develops your ability to create logics/expressions which are the basic structure of any program.

But remember always, learn programming, not languages.

It is not necessary that you learned C before C++. But Why? let’s take a look,

 

Difference between C and C++

C C++
C is a language of Procedural Oriented Programming (POP) type. C++ is Object Oriented Programming (OOP) based language, although it also supports POPs.
There is no reference variable in it. In this the reference is variable.
In this, scanf is used for input and for printf used for output. It uses cin for input and cout for output.
In this, member of a Structure can not be a function type member means, all members are of data type type. In this, a member of a structure can be a member of a function type. means, data type and function type member, both are possible (see example).
Because it is a POP based language, it does not support features like class, data hiding, data encapsulation, data abstraction, inheritance, polymorphisms (virtual function, function overloading, operator overloading). Whereas it supports all the features like class, object, data hiding, data encapsulation, data abstraction, inheritance, polymorphism (virtual function, function overloading, operator overloading).
It uses calloc and malloc for memory allocation whereas for de-allocation, free function is used. In this, the new operator is used for memory allocation while the delete operator is used for de-allocation. But C ++ supports two Programming based so it also supports calloc, malloc and free function.
In C, a program is divided into functions. whereas in C ++, a program is divided into the class and object.
In C, the file extension is c. In C++, the file extension is .cpp.

 

If we talk about the difference between C and C ++, then this is only the difference of OOPs. The concept of OOPs is based on the class and object, because almost all the features of OOPs in C ++, such as data abstraction, inheritance, polymorphism etc. are implemented from the class itself.

C++ or any other programming language. When we say that there is an OOPs type language, what does it mean? Let’s understand it with an example.

Below are two programs that have been asked to input two numbers from the user who print their sum. Both programs are performing the same operation

But the first program is created in C language, the way POPs while the second program is created in C ++ language, in OOPs way.

You can see the difference in both.

 

add two number in C language POPs based

#include <stdio.h>
#include<conio.h>

int main() // program start here
{
  int first,second,sum; // variable declaration inside main()

  printf("Enter two integers: ");
  scanf("%d %d", &first, &second);

  sum = first + second;
  printf("%d + %d = %d", first, second, sum); // printing values

  getch();
  return 0;
}
OUTPUT:-
Enter two numbers: 4 3
4 + 3 = 7

 

add two number in C++ language OOPs based

#include<conio.h>
#include<iostream.h>

class total
{
  Private:
  int first,second,sum;  // variable declaration outside main()
  public: 
  void get_num(void); 
};

 void total::get_num(void)
 {
   cout<<"Enter two numbers: ";
   cin>>first>>second;
   sum = first + second;
   cout<<first<<" + "<<second<<" = "<<sum; // printing values
 }

int main() // main program start here
{
  total object;
  object.get_num();
  getch();
  return 0;
 }
OUTPUT:-
Enter two numbers: 4 3
4 + 3 = 7

more about OOPs is described in the Programming with OOPs page

Because C ++ supports both Procedure Oriented Programming (POP) and Object Oriented Programming (OOP), so the POP based technique has been used in all the concepts before class. In a way, only syntex remains different in these and C language.

so are you ready!

next-Structure of a Program in C++