- 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++
![Ayush Gupta](https://www.tutorialspoint.com/assets/profiles/134135/profile/60_13095-1568350695.jpg)
179 Views
In this tutorial, we will be discussing a program to understand how to quickly swap two arrays of same size in C++.For this we will be using a quick method called std::swap() for swapping the elements of the two given arrays.Example Live Demo#include #include using namespace std; int main (){ int a[] = {1, 2, 3, 4}; int b[] = {5, 6, 7, 8}; int n = sizeof(a)/sizeof(a[0]); swap(a, b); cout
![Ayush Gupta](https://www.tutorialspoint.com/assets/profiles/134135/profile/60_13095-1568350695.jpg)
248 Views
In this tutorial, we will be discussing a program to understand how to print a semicolon(;) without using a semicolon in /C++.This can be done in two possible ways, either by using the ascii value of semicolon or using user-defined macros for the same.Example Live DemoUsing putchar() method#include int main(){ //ASCII value of semicolon is equal to 59 if (putchar(59)){ } return 0; }Output;Example Live DemoUsing Macros :#include #define POINT printf("%c",59) int main(){ if (POINT) { } }Output;
![Ayush Gupta](https://www.tutorialspoint.com/assets/profiles/134135/profile/60_13095-1568350695.jpg)
170 Views
In this tutorial, we will be discussing a program to understand how to join two given vectors using STL library in C++.To join two given vectors we would be using the set_union() method from the STL library.Example Live Demo#include using namespace std; int main(){ //collecting 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
![Sunidhi Bansal](https://www.tutorialspoint.com/assets/profiles/124656/profile/60_131452-1581053210.jpg)
163 Views
In this article we are going to discuss the deque::at() and deque::swap() function in C++ STL function syntax, working and its return values.What is deque::at() and deque::swap() function in STL?Deque or Double ended queues are as name suggests, sequence containers which can be expanded or contracted at both the ends. The user can easily insert data from any of the ends and similarly delete data from any of the ends. They are similar to vectors, but the only difference is that unlike vectors, contiguous storage allocation may not be guaranteed. Still Deque is more efficient in case of insertion and ... Read More
![Sunidhi Bansal](https://www.tutorialspoint.com/assets/profiles/124656/profile/60_131452-1581053210.jpg)
2K+ Views
In this article we will be discussing the working, syntax and examples of list::pop_back() function in C++.What is a List in STL?List 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 is list::pop_back()?list::pop_back() ... Read More
![Sunidhi Bansal](https://www.tutorialspoint.com/assets/profiles/124656/profile/60_131452-1581053210.jpg)
3K+ Views
In this article we will be discussing the working, syntax and examples of list::merge() function in C++.What is a List in STL?List 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 is list::merge()?list::merge() ... Read More
![Sunidhi Bansal](https://www.tutorialspoint.com/assets/profiles/124656/profile/60_131452-1581053210.jpg)
916 Views
In this article we will be discussing the working, syntax and examples of list::erase() function in C++.What is a List in STL?List 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 is list::erase()?list::erase() ... Read More
![Sunidhi Bansal](https://www.tutorialspoint.com/assets/profiles/124656/profile/60_131452-1581053210.jpg)
278 Views
In this article we will be discussing the working, syntax and examples of forward_list::remove() and forward_list::remove_if() functions in C++.What is a Forward_list in STL?Forward list are sequence containers that allow constant time insert and erase operations anywhere within the sequence. Forward list are implement as a singly-linked lists. The ordering is kept by the association to each element of a link to the next element in the sequence.What is forward_list::remove()?forward_list::remove() is an inbuilt function in C++ STL which is declared in header file. remove() is used to removes all the elements from the forward_list. The container size is decresed by ... Read More
![Sunidhi Bansal](https://www.tutorialspoint.com/assets/profiles/124656/profile/60_131452-1581053210.jpg)
223 Views
In this article we will be discussing the working, syntax and examples of forward_list::push_front() and forward_list::pop_front() functions in C++.What is a Forward_list in STL?Forward list are sequence containers that allow constant time insert and erase operations anywhere within the sequence. Forward list are implement as a singly-linked lists. The ordering is kept by the association to each element of a link to the next element in the sequence.What is forward_list::push_front()?forward_list::push_front() is an inbuilt function in C++ STL which is declared in header file. push_front() is used to push/insert an element or a value in the front or at the beginnig ... Read More
![Sunidhi Bansal](https://www.tutorialspoint.com/assets/profiles/124656/profile/60_131452-1581053210.jpg)
7K+ Views
In this article we will be discussing the working, syntax and examples of list::size() function in C++.What is a List in STL?List 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 is list::size()?list::size() ... Read More