
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++

141 Views
The deque back( ) function is used to reference last element of deque.Syntaxdequename.back( )ExampleInput Deque − 11 12 13 14 15Output New Deque − 15Input Deque − C H O I C EOutput New Deque − EApproach can be followedFirst we declare the dequeThen we print the deque.Then we define the back( ) function.By using above approach we can fetch the last element of the deque.Example// C++ code to demonstrate the working of deque back( ) function #include #include Using namespace std; int main( ){ // initializing deque deque deque ={ 14, 15, 16, 17, 18 }; cout

433 Views
Given is the task to show the functionality of deque front( ) and deque back( ) function in C++ STLWhat is DequeDeque is the Double Ended Queues that are the sequence containers which provides the functionality of expansion and contraction on both the ends. A queue data structure allow user to insert data only at the END and delete data from the FRONT. Let’s take the analogy of queues at bus stops where the person can be inserted to a queue from the END only and the person standing in the FRONT is the first to be removed whereas in ... Read More

269 Views
Given is the task to show the functionality of deque push_back( ) function in C++ STLWhat is DequeDeque is the Double Ended Queues that are the sequence containers which provides the functionality of expansion and contraction on both the ends. A queue data structure allow user to insert data only at the END and delete data from the FRONT. Let’s take the analogy of queues at bus stops where the person can be inserted to a queue from the END only and the person standing in the FRONT is the first to be removed whereas in Double ended queue the ... Read More

9K+ Views
Given is the task to show the functionality list insert( ) function in C++ in STL.What is List in STLList are containers that allow constant time insertion and deletion anywhere in sequence. List are implemented as doubly linked lists. List allow non-contiguous memory allocation. List perform better insertion extraction and moving of element in any position in container than array, vector and deque. In List the direct access to the element is slow and list is similar to forward_list, but forward list objects are single linked lists and they can only be iterated forwards.What is insert( )The list insert( ) ... Read More

245 Views
Given is the task to show the functionality of deque resize( ) function in C++ STL.What is DequeDeque is the Double Ended Queues that are the sequence containers which provides the functionality of expansion and contraction on both the ends. A queue data structure allow user to insert data only at the END and delete data from the FRONT. Let’s take the analogy of queues at bus stops where the person can be inserted to a queue from the END only and the person standing in the FRONT is the first to be removed whereas in Double ended queue the ... Read More

384 Views
Given is the task to show the functionality list unique( ) function in C++ in STL.What is List in STLList are containers that allow constant time insertion and deletion anywhere in sequence. List are implemented as doubly linked lists. List allow non-contiguous memory allocation. List perform better insertion extraction and moving of element in any position in container than array, vector and deque. In List the direct access to the element is slow and list is similar to forward_list, but forward list objects are single linked lists and they can only be iterated forwards.What is unique( )The list unique( ) ... Read More

589 Views
Given is the task to show the functionality list begin( ) and list end( ) function in C++ in STL.What is List in STLList is a data structure that allows constant time insertion and deletion anywhere in sequence. Lists are implemented as doubly linked lists. Lists allow non-contiguous memory allocation. List perform better insertion extraction and moving of element in any position in container than array, vector and deque. In List the direct access to the element is slow and list is similar to forward_list, but forward list objects are single linked lists and they can only be iterated forwards.What ... Read More

5K+ Views
In this tutorial, we will be discussing a program to understand how to convert a class to another class type in C/C++.Class conversion can be done with the help of operator overloading. This allows data of one class type to be assigned to the object of another class type.Example Live Demo#include using namespace std; //type to which it will be converted class Class_type_one { string a = "TutorialsPoint"; public: string get_string(){ return (a); } void display(){ cout

820 Views
In this tutorial, we will be discussing a program to understand how to find the sum of elements of a vector using STL in C++.To find the sum of elements of a given vector, we would be using the accumulate() method from the STL library.Example Live Demo#include using namespace std; int main(){ //defining the vector vector a = { 1, 45, 54, 71, 76, 12 }; cout

7K+ Views
A vector in C++ is a dynamic array that stores elements of the same data type and can change its size when needed. In this article, we are given a vector and our goal is to find the maximum (largest) element using different STL methods in C++. Let's understand this with an example: // Example 1 std::vector vec1 = {11, 13, 21, 45, 8}; The largest element is 45. // Example 2 std::vector vec2 = {1, 9, 2, 5, 7}; The largest element is 9. Finding Maximum Element of a Vector Using STL in ... Read More