- 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 7346 Articles for C++
9K+ Views
Dequeue or Double Ended Queue is a generalized version of Queue data structure that allows insert and delete at both ends.Some basic operations of dequeue are −insert_at_beg(): inserts an item at the front of Dequeue.insert_at_end(): inserts an item at the rear of Dequeue.delete_fr_beg(): Deletes an item from front of Dequeue.delete_fr_rear(): Deletes an item from rear of Dequeue.Following is a C++ program to implement DequeueAlgorithmBegin Declare a class dequeue to declare front f and rear r and following functions: function insert_at_beg(int) to insert item at front: If queue is not completely filled up, insert element at ... Read More
986 Views
StackThe stack which is implemented as LIFO, where insertion and deletion are done from the same end, top. The last element that entered is deleted first.Stack operations are −push (int data) − Insertion at topint pop() − Deletion from topQueueThe queue which is implemented as FIFO where insertions are done at one end (rear) and deletions are done from another end (front). The first element that entered is deleted first.Queue operations are −EnQueue (int data) − Insertion at the rear endint DeQueue() − Deletion from front endThis is a C++ Program to Implement Stack Using Two QueuesAlgorithmsBegin function enqueue1 to ... Read More
2K+ Views
StackThe stack which is implemented as LIFO, where insertion and deletion are done from the same end, top. The last element that entered is deleted first.Stack operations are −push (int data) − Insertion at topint pop() − Deletion from topQueueThe queue which is implemented as FIFO where insertions are done at one end (rear) and deletions are done from another end (front). The first element that entered is deleted first.Queue operations are −EnQueue (int data) − Insertion at rear endint DeQueue() − Deletion from front endThis is a C++ Program to Implement Queue Using Two Stacks.Description of functionsfunction enQueue() to ... Read More
345 Views
In this C++ program, as input, a text and a pattern are given. As output, the pattern is searched in the text and all instances of the pattern are given.AlgorithmBegin Take the string and pattern as input. Declare the original and duplicate array with their size. Put the lengths of original and duplicate in len_ori and len_dupli. Make a loop for find out the position of the searched pattern. If pattern is not found, print not found otherwise print the no of instances of the searched pattern. EndExample Code Live Demo#include #include using namespace std; ... Read More
329 Views
This is a C++ Program to Implement Bitap Algorithm for String Matching. The algorithm tells whether a given text contains a substring which is “approximately equal” to a given pattern, where approximate equality is defined in terms of Levenshtein distance — if the substring and pattern are within a given distance k of each other, then according to the algorithm they are equal. It begins by precomputing a set of bitmasks containing one bit for each element of the pattern. So we are able to do most of the work with bitwise operations, which are extremely fast.AlgorithmBegin Take the ... Read More
2K+ Views
In this section, you will learn how to use SQLite in C/C++ programs.InstallationBefore you start using SQLite in our C/C++ programs, you need to make sure that you have SQLite library set up on the machine. You can check SQLite Installation chapter to understand the installation process.C/C++ Interface APIsFollowing are important C/C++ SQLite interface routines, which can suffice your requirement to work with SQLite database from your C/C++ program. If you are looking for a more sophisticated application, then you can look into SQLite official documentation.Serial NoAPI & Description1sqlite3_open(const char *filename, sqlite3 **ppDb)This routine opens a connection to an SQLite ... Read More
197 Views
Virtual functions calling from a constructor or destructor is dangerous and should be avoided whenever possible as the virtual function we call is called from the Base class and not from the derived class.The reason is that in C++ Super-classes are constructed before derived classes. So, in the following example, as B must be instantiated, before D is instantiated. When B's constructor is called, it's not D yet, so the virtual function table still has the entry for B's copy of s().Example Code Live Demo#include using namespace std; class B { public: B() { s(); } ... Read More
3K+ Views
In this section, you will learn how to use SQLite in C/C++ programs.InstallationBefore you start using SQLite in our C/C++ programs, you need to make sure that you have SQLite library set up on the machine. You can check the SQLite Installation chapter to understand the installation process.C/C++ Interface APIsFollowing are important C/C++ SQLite interface routines, which can suffice your requirement to work with SQLite database from your C/C++ program. If you are looking for a more sophisticated application, then you can look into SQLite official documentation.Serial NoAPI & Description1sqlite3_open(const char *filename, sqlite3 **ppDb)This routine opens a connection to an ... Read More