Introduction of C++

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


Download this as PDF format introduction of C++

C++ History

C++ is an object-oriented programming language which was developed by Bjarne Stroustrup in 1983 in AT & Bell Laboratories.

Because C++ is an updated version of C itself. So it supports all the features of C as well as supports OOPs. If 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.

Due to low level and high level programming it is known as middle level language.

Read more about C++ History.

C++ features

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

Because this tutorial has been designed for Beginners who have never worked on C language, we will study about these advanced features further in this tutorial. Difference between C and C++ is a good option for starting. but before let’s know some real uses of C++.

Note : C++ has pointer(memory manipulation), global-variable(many function access, memory wastage), and friend-function(private member accessing) which create some security issues in it.

But still it’s widely used as following,

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 developing high-use graphics software such as gaming, animation, motion graphics, virtual reality device.
  • C++ provides speed, so it is used by web browsers, for example, Google Chrome, Mozilla Firefox, internet explorer, Opera mini, Google, Facebook, Yahoo etc.
  • The compiler of other programming languages ​​like Java, C, C # etc have been written mostly in C++ language.
  • 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 a 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++ has also used in-system programming (in low level) which controls any hardware. Such as Robotics, router, system driver, networking switch etc.
  • Other use are – 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 centre, 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 to us, 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 a program.

But remember always, Learn programming, Not languages.

It is not necessary that you learned C before C++. you can understand this with the help of Difference Between C and C++ here,

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. C++ supports reference 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.
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 encapsulation, data hiding/data abstraction, inheritance, Polymorphism (virtual function, function overloading, operator overloading).
It use 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.

You can see the Below Program to understand the difference between C and C++,

In the below Program, we add two numbers both programs are performing the same operation but made in a different way.

add two number in C language

#include <stdio> 
using namespace std;

int main() // program start here 
{  
  int first,second,sum; // variable declaration 
  
   printf("Enter two integers: ");  
   scanf("%d %d", &first, &second);  
   
      sum = first + second; 
 
   printf("%d + %d = %d", first, second, sum); 
   getch();  
   return 0; 
}

OUTPUT

Enter two numbers: 4 3
4 + 3 = 7

add two number in C++ language

#include<iostream.h>
using namespace std;
class total
{
  private:
  int first,second,sum;  // variable declaration
  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 in C++

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

: This Tutorial based on Dev C++ Platform.

So are you ready!


next- simple hello word Program in C++

Like it?

Leave a Reply

Your email address will not be published. Required fields are marked *

Exit mobile version