- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- 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 7347 Articles for C++
184 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
175 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
271 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
449 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
4K+ 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
598 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
6K+ Views
In this tutorial, we will be discussing a program to understand how to find the maximum element of a vector using STL in C++.To find the maximum element from a given vector, we will be using the *max_element() method from STL library.Example Live Demo#include using namespace std; int main(){ //defining the vector vector a = { 1, 45, 54, 71, 76, 12 }; cout
746 Views
In this tutorial, we will be discussing a program to understand how to find common elements between two vectors using STL in C++.To find the common elements between two given vectors we will be using the set_intersetion() method.Example Live Demo#include using namespace std; int main(){ //defining the vectors vector vector1 = { 1, 45, 54, 71, 76, 12 }; vector vector2 = { 1, 7, 5, 4, 6, 12 }; sort(vector1.begin(), vector1.end()); sort(vector2.begin(), vector2.end()); cout
209 Views
In this tutorial, we will be discussing a program to understand how to find common elements between two arrays using STL in C++.To find the common elements between two given arrays we will be using the set_intersetion() method.Example Live Demo#include using namespace std; int main(){ //defining the array int arr1[] = { 1, 45, 54, 71, 76, 12 }; int arr2[] = { 1, 7, 5, 4, 6, 12 }; int n1 = sizeof(arr1) / sizeof(arr1[0]); int n2 = sizeof(arr2) / sizeof(arr2[0]); sort(arr1, arr1 + n1); sort(arr2, arr2 + n2); cout