
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 7197 Articles for C++

1K+ Views
Suppose we have one STL set in C++. There are few elements. We have to delete the last element from that set. So if the elements are like [10, 41, 54, 20, 23, 69, 84, 75], then the set will be like [10 20 23 41 54 69 75 84], and last element is 84. We will see the C++ code to delete last element from set.Example Live Demo#include #include using namespace std; void display(set my_set){ for (auto it = my_set.begin(); it != my_set.end(); ++it) cout

623 Views
Here we will see how to delete the last element from C++ STL map. The map is the hash table based data type, it has key and value. We can use the prev() method to get last element, and erase() function to delete as follows.Example Live Demo#include #include using namespace std; int main() { map my_map; my_map["first"] = 10; my_map["second"] = 20; my_map["third"] = 30; cout

588 Views
Suppose we have one STL list in C++. There are few elements. We have to delete the last element from that list. So if the elements are like [10, 41, 54, 20, 23, 69, 84, 75], then last element is 75. We will see the C++ code to delete last element from list.Example Live Demo#include #include using namespace std; void display(list my_list){ for (auto it = my_list.begin(); it != my_list.end(); ++it) cout

959 Views
In this article, we will explain how to delete an element from a set in C++ by passing its value. A set stores elements in sorted order, where each element is unique and cannot be modified once added. While the values cannot be changed, we can add or remove elements using the erase() function from the C++ Standard Library (STL). For example, if we have a set of integers: {1, 2, 3, 4, 5} and want to remove the element 3, we can use the erase() function. After the operation, the set will be {1, 2, 4, 5}, ... Read More

469 Views
In C++ the Maps and unordered maps are hash tables. They use some keys and their respective key values. Here we will see how to check whether a given key is present in the hash table or not. The code will be like below −Example Live Demo#include #include using namespace std; string isPresent(map m, string key) { if (m.find(key) == m.end()) return "Not Present"; return "Present"; } int main() { map my_map; my_map["first"] = 4; my_map["second"] = 6; my_map["third"] = 6; string check1 = "fifth", check2 = "third"; cout

191 Views
Here we will see what is Array Decay. The loss of type and dimensions of an array is called array decay. It occurs when we pass the array into a function by pointer or value. The first address is sent to the array which is a pointer. That is why, the size of array is not the original one.Let us see one example of array decay using C++ code,Example Live Demo#include using namespace std; void DisplayValue(int *p) { cout

7K+ Views
As we know the bit-wise AND is represented as ‘&’ and the logical operator is represented as ‘&&’. There are some fundamental differences between them. These are as follows − bitwise AND operator The bitwise AND (&) operator performs a bit-by-bit AND operation between two integers. The bitwise AND operator works on integer, short int, long, unsigned int type data, and also returns that type of data. Here, Each bit should be 1 to give the result as 1, else it will result in 0, 1 & 1 = 11 & 0 = 00 & 1 = 00 & 0 ... Read More

130 Views
Suppose we have a string S and a number X. There are M different players who roll the dice. one player keeps on rolling the dice until he gets a number other than X. Here in the string S, S[i] represents the number at ith roll of a dice. We have to find the value of M. One constraint is that the last character in S will never be X. So for example, if string is “3662123” and X = 6, the output will be 5. This can be described as follows −First player rolls and got 3Second player rolls, ... Read More

226 Views
Suppose we have one integer array with n elements. We have to find the maximum product of a quadruple in the array. So if the array is like [3, 5, 20, 6, 10], then final product is 6000, and elements in quadruple is 10, 5, 6, 20To solve this, we will follow these steps −Sort the array in ascending orderSuppose x be the product of last four elements, y be the product of first four elements, and z be the product of first two and second two elementsReturn the max of x, y and z.Example Live Demo#include #include using namespace std; ... Read More

3K+ Views
In this article, we will explain how to find the node with the minimum value in a binary search tree (BST) and provide a C++ implementation. A binary search tree is a data structure that stores data in a sorted order such that for every node, the left subtree contains values less than the node's value, and the right subtree contains values greater than the node's value. Find Minimum Value in a Binary Search Tree Given the root node of a binary search tree, the task is to find the node with the minimum value in the tree. The ... Read More