C++ is the middle-level object-oriented programming language. For the enhancement of C language C++ was developed by Bjarne Stroustrup at Bell Labs in New Jersey. You can find freelancers who have knowledge and experience of C++ programming language.

Variables in C++:

Each variable in C++ finds out the size and layout of the variables memory. Variable is the combination of digits, letters, and underscore character. The variable must begin with a letter or an underscore.

  • Bool: bool is a variable which stores two values that are true and false.
  • Char: char is a variable which is typically a single octet of an integer type.
  • Int: int represents the unsigned integer type.
  • Float: float represents the single precision floating point number.
  • Double: double represent the double precision floating point number.
  • Void: void represent the absence of type.
  • wchar_t: wchar_t represent the wide character type.

Declaration of a variable:

type variable_list;

Loop in C++:

while Loop:

‘While loop’ is used to iterate a part of the program many times as long as a condition is true. If the number of iterations is not fixed, then the ‘while loop’ is better than the ‘for loop’.

while(condition) {

statement(s);

}

For Loop:

A for loop repeats the part of the program several times. It is the repetition control statement that allows you to write a loop that must get executed at a specific number of times.

for ( init; condition; increment ) {

statement(s);

}

do…..while loop

do….while is same as the while loop only difference is that in do while loop statement is executed at least once irrespective of condition.

Nested Loop:

C++ allows a programmer to use the concept of a nested loop. A nested loop is a concept of executing one loop inside another loop.

for ( init; condition; increment ) {

for ( init; condition; increment ) {

statement(s);

}

statement(s);

}

Function in C++:

A function is a block of statements which in combination performs the task. Each C++ program has one main () function. Through function, you can divide your code.

  • Function Declaration:

return_type function_name( parameter list );

  • Function Definition

return_type function_name( parameter list ) {

a body of the function

}

Array:

The array is the collection of similar type of data type. The array allows code optimization, random access, easy to traverse data, and easy to manipulate data.

  • Declaration of Array:

type arrayName [ arraySize ];

  • Initialisation of Array:

int student_id[5] = {1,2,3,4,5};

Pointer:

A pointer is a variable which stores the value of another variable. The concept of pointer reduces the code and improves the performance. Through the concept of pointer, you can access any memory location in the computer’s memory. Using the pointer, you can return multiple values from a function.

Declaration of Pointer in C++

type *var-name;

Inheritance:

Inheritance is one of the important aspects of object-oriented programming language. Inheritance is the process in which one object acquires all the properties and behaviours of other objects. The class which inherits the members of another class is called derived class, and the class whose members are inherited is called base class. You can find freelancers who have knowledge and experience of C++ programming language.

Polymorphism:

The word polymorphism is the combination of poly + morph it means many forms.

  • Compile time polymorphism: Compile time polymorphism is through static binding or early binding.
  • Runtime polymorphism: Runtime polymorphism is through method overriding which is also known as dynamic binding and late binding.

Data abstraction:

Data abstraction is the important concept of object-oriented programming which hides the background details and only shows important information to the outside world.

#include <iostream>

using namespace std;

int main() {

cout << “Hello world” <<endl;

return 0;

}

Interface:

The interfaces in C++ are implemented using abstract classes, and these abstract classes keep the implementation details separate from the associated data.

class table {

public:

// pure virtual function

virtual double getVolume() = 0;

private:

double length;

double breadth;

double height;

};

Multithreading:

Multithreading is the process which enables your computer to run two or more program concurrently.  A multithreaded program contains two or more parts that can run concurrently. Each part of such a program is called a thread, and each thread defines a separate path of execution. Multithreaded programs contain two or more part that executes concurrently. Every part of the program is known as a thread, and every thread defines a separate path of execution.

Summary:

This article is about the C++ tutorial. This article covers all the basic and advanced topic of C++ programming. This article is very useful for those programmers who want a basic knowledge of C++ programming language.

Kitty Gupta