×
Home Discussions Write at Opengenus IQ
×
  • DSA Cheatsheet
  • HOME
  • Track your progress
  • Deep Learning (FREE)
  • Join our Internship 🎓
  • RANDOM
  • One Liner

C++

C++ is a powerful, object oriented and early programming language which is derived from C. It is widely used in production systems and gives huge control to the programmer.

C++

Containers in C++ STL

In C++ STL, Containers or container classes store objects and data. There are in total seven standard “first-class” container classes and three container adaptor classes and only seven header files that provide access to these containers or container adaptors.

Harshita Sahai Harshita Sahai
C++

Enumeration in C++

Enumeration (or enum) is a user defined data type in C and C++. It is mainly used to assign names to integral constants, the names make a program easy to read and maintain.

Harshita Sahai Harshita Sahai
C++

while loop in C++

while loop is a most basic loop in C++. while loop has one control condition, and executes as long the condition is true. The condition of the loop is tested before the body of the loop is executed, hence it is called an entry-controlled loop.

Harshita Sahai Harshita Sahai
C++

User defined functions in C++

A function is a group of statements that together perform a task. Every C++ program has at least one function, which is main(), and all the most trivial programs can define additional functions. Users can create custom functions for code reusability and optimization

Kavita Bisht
C++

Multimap in C++ STL

Multi-map in C++ is an associative container like map. It internally store elements in key value pair. But unlike map which store only unique keys, multimap can have duplicate keys.

Kavita Bisht
C++

Set in C++ STL

In C++ STL, a set is an Associative container which contains a sorted set of unique objects of type Key. The commonly used functions are begin(), cbegin(), end(), size(), max_size(), empty(), insert(), erase(), emplace() and emplace_hint()

Kavita Bisht
C++

Unordered map in C++ STL

In C++ STL, Unordered map is a dictionary like data structure. The most commonly used methods of unordered_map are at(), begin(), end(), bucket(), bucket_count() / bucket_size(), count(), equal_range(), hash_function(), insert(), reserve() and load_factor()

Kavita Bisht
C++

switch case in C++

A switch statement in C++ allows a variable to be tested for equality against a list of values. Each value is called a case, and the variable being switched on is checked for each case.

Harshita Sahai Harshita Sahai
C++

do while loop in C++

Do while loop in C++ is an exit controlled loop and hence, it executes at least once even when the test-expression is false initially. We illustrate the concept and usage in C with different examples

Harshita Sahai Harshita Sahai
C++

Builder Pattern in C++

Builder pattern in C++ aims to “Separate the construction of a complex object from its representation so that the same construction process can create different representations.” It is used to construct a complex object step by step and the final step will return the object.

Harshita Sahai Harshita Sahai
C++

Default arguments in C++

A default argument in C++ is a value provided in a function declaration that is automatically assigned by the compiler if the caller of the function doesn’t provide a value for the argument with a default value.

Harshita Sahai Harshita Sahai
C++

Iterators in C++ STL

Iterators in C++ Standard Template Library are used to point at the memory addresses of STL containers. They are primarily used in sequence of numbers, characters etc. They reduce the complexity and execution time of program.

Harshita Sahai Harshita Sahai
C++

if else statement in C++

If else statement in C++ are program control statements that are widely used. We explore it and its variants like if else if, nested if else and if statements.

Harshita Sahai Harshita Sahai
C++

Map in C++ STL

Map in C++ STL is a dictionary like data structure. It is a sequence of (key, value) pair, where only single value is associated with each unique key. It is often referred as associative array.

Kavita Bisht
C++

Reader Writer Problem in C++ using semaphore and monitor

We will focus on solving the Reader Writer problem in C++ by using Semaphores as our first approach and Monitors as our second approach. It is a problem designed to illustrate synchronization within processes.

Kavita Bisht
C++

Factory Pattern in C++

Factory method also known as a static class is a creational design pattern, i.e. it is related to object creation. In this we create object without exposing the creation logic to client and the client use the same common interface to create new type of object. Idea is to use a static member function

Harshita Sahai Harshita Sahai
C++

constructor in C++

A constructor is a member function of a class which initializes objects of a class. In C++, Constructor is automatically called when object(instance of class) is created it is considered to be a special member function of the class.

Harshita Sahai Harshita Sahai
C++

delete operator in C++

In C++, Delete is an operator that is used to destroy array and non-array(pointer) objects which are created by new operator as well as NULL pointers. Using operator overloading, we can delete user defined objects as well

Harshita Sahai Harshita Sahai
C++

new operator in C++

In C++, the new operator denotes a request for memory allocation on the Heap. If sufficient memory is available, new operator initializes the memory and returns the address of the newly allocated and initialized memory to the pointer variable.

Harshita Sahai Harshita Sahai
C++

Classes and Objects in C++

In C++, a class is a mechanism for creating user-defined data types. A class is used to specify the form of an object and it combines data representation. The variables inside class definition are called as data members and the functions are called member functions.

Kavita Bisht
C++

Scopes in C++

Scope is defined as the extent to which something can be worked with (or a scope is a region of the program ). In C++, there are 9 types: Global scope, Local scope, Namespace scope, Class scope, Statement scope, Function scope, Function parameter scope, Enumeration scope and Template parameter scope

Kavita Bisht
C++

Priority Queue in C++ STL

Priority queue in the STL of C++ is a dynamically resizing container to implement the special case of priority queye under the queue data structure. It is a sequential linear container. The top element of the priority queue is the greatest with all elements arranged in non-increasing order.

Arvind Tatiparti
C++

Queue in C++ STL

Queue in the STL of C++ is a dynamically resizing container to implement the queue data structure. It is a sequential linear container which follows the First In First Out(FIFO) arrangement. We explore the various functions like empty, size, swap, emplace, front, back, push and pop operations

Arvind Tatiparti
C++

Virtual Function in C++

A virtual function in C++ is a member function which is declared within a base class and is overriden by a derived class. When you refer to a derived class object using a pointer or a reference to the base class, you can call a virtual function for that object and execute the derived class function

Harshita Sahai Harshita Sahai
C++

Vector in C++

Vector is a sequence container that can store elements, but its size can change dynamically (C/C++ array’s size do not change dynamically). We can store int, string, float elements, depending on how we initialize the vector.

Shreya Gupta Shreya Gupta
OpenGenus IQ © 2025 All rights reserved ™
Contact - Email: team@opengenus.org
Primary Address: JR Shinjuku Miraina Tower, Tokyo, Shinjuku 160-0022, JP
Office #2: Commercial Complex D4, Delhi, Delhi 110017, IN
Top Posts LinkedIn Twitter
Android App
Apply for Internship