C++ Programming Tutorial

 
 
 

Data File Structure Programs

Array

Insert, edit, delete, append, display, Srch. Insert, delete, merge, delete multiple occurrences Arrays as a Stack in graphics

Stack

Stack operations using array Stack using static memory allocation Stack using dynamic memory allocation Double ended link list as a stack Lnked list as a Stack Infix expr. to Postfix expr. Postfix expr. into an Infix expr. Arrays as a Stack in graphics Stack as an Arithmetic expr. Evaluater Graphical Rep. of Stack Stack to traverse - inodr, postodr, preodr

Queue

Queue using static memory allocation Queue using dynamic memory allocation Circular queue Linked list as a Queue Double Ended linked list as a Queue Graphical Rep. of Queue Arrays as a Linear Queue Array as a Circular Queue Arrays as a Linear Queue ( in graphics ) Arrays as a Circular Queue ( in graphics )

Linked List

Singly link list Circular linked list Doubly link list Linked list as a Queue Linked list as a Stack Double Ended linked list as a Queue Double Ended linked list as a Stack Infix to Postfix - Linked List as Stack Circular doubly link list Single Ended Linked List - Sorting in both odr Hashing - double ended Linked List Sort of link list

Tree

Linked List as a Binary Srch. Tree Set Class using Binary Srch. Tree Maximum depth of Binary Srch. Tree Minimum Spaning Tree Prims algo - minimum spanning tree Traverse binary tree - inodr, preodr, post Find number in binary Srch. tree display levell

Sorting

Bubble Sort Selection Sort Insertion Sort Radix Sort Merge Sort Quick Sort Heap Sort Linear Sort Shell Sort Topological Sort

Searching

Linear Srch. or Sequential Srch. Binary Search Breadth First Search Traversal Depth First Search Traversal Shortest Path-Given Source-Destination-Dijkstras

Hashing

Simple implementation of Hashing Hashing using double-ended Linked List Hashing using Mid-Square Method Example of Hashing n term of the fibonacci series using recursion

Recursion

Factorial of the given number using recursion Mystery of Towers of Hanoi using recursion
 
 

Image

# include <iostream.h>
# include <process.h>
# include <conio.h>
int display_menu();
class circularqueue
{
  int arr[10];
  int front,rear;
  int size;
  public:
     circularqueue()
     {
      front=0;
      rear=0;
      size=10;
     }
     void display();
     void enqueue();
     void delete_element();
};

void circularqueue :: display()
{
 cout<<endl;
 if(front!=0 && rear!=0)
 {
        int i=front;
        cout<<\"arr[\"<<i<<\"] :\"<<arr[i]<<endl;
        while(i!=rear)
        {
         i=(i % size)+1;
         cout<<\"arr[\"<<i<<\"] :\"<<arr[i]<<endl;
        }

 }
 else
 {
    cout<<\"Queue is empty\"<<endl;
 }
 getch();
}

void circularqueue :: enqueue()
{
 cout<<endl;
 if(front==0 && rear==0)
 {
  cout<<\"Enter Number to enqueue at Position arr[\"<<rear+1<<\"] :\";
  cin>>arr[1];
  rear=1;
  front=1;
 }
 else
 {
  int next=(rear % size)+1;






  if(next==front)
  {
   cout<<\"Queue is Full ...\";
   getch();
  }
  else
  {
   cout<<\"Enter Number to enqueue at Position arr[\"<<next<<\"] :\";
   cin>>arr[next];
   rear=next;
  }
 }
}

void  circularqueue :: delete_element()
{
 cout<<endl;
 if(rear==0 && front==0)
 {
   cout<<\"Queue is empty ...\";
   getch();
   return;
 }


 if(rear==front)
 {
  rear=0;
  front=0;
 }
 else
 {
  front=(front % size)+1;
 }
}
void main()
{
 circularqueue cq1;
 while(1)
 {
  switch(display_menu())
  {
    case 1: cq1.enqueue();
        break;
    case 2: cq1.delete_element();
        break;
    case 3: cq1.display();
        break;
    case 4: exit(1);
  }
 }
}
int display_menu()
{
 int c;
 clrscr();
 cout<<endl;
 cout<<\"| 1 | : Enqueue element\"<<endl;
 cout<<\"| 2 | : Delete element\"<<endl;
 cout<<\"| 3 | : Display\"<<endl;
 cout<<\"| 4 | : Exit\"<<endl;
 cout<<\"Enter your Choice :\";
 cin>>c;
 return c;
}

    Related Post:
  1. Program to add, subtract, multiply, sort, search, transpose and merge matrices

  2. PROGRAM TO IMPLEMENT RECURSIVE DESCENT PARSER

  3. Program that takes 10 integer from a user and perform addition using class

  4. Program to count number of words, lines and characters in given string

  5. Program to illustrate the Insertion Sort

  6. Program that uses this DFA and validates whether an entered string is valid float or not

  7. Program of that provides an example of function overloading

  8. Program that reads a number and displays it with its digits in reverse order (using while loop)

  9. Program of vector class that perform different operations on vector

  10. Program to illustrate unary operator (increment operator) overloading without return type

  11. Program of rotate about reference point

  12. Program to illustrate the implementation of Translation Transformation.

  13. Program to read a Non-Linear equation in one variable, then evaluate it using Newton-Raphson Method and display its kD accurate root

  14. Program of Education System that maintains Institute Database using multilevel inheritance

  15. Program that provides an example of destructors

  16. Program that creats a 3D solid object using Rotational Sweep Representatiom Method

  17. Program to get possible prime numbers like number 6158 contains the substrings 6, 1, 5, 8, 61, 15, 58, 615, 158, and 6158.Find the largest substring..

  18. Program of calculator

  19. Program to implement Add and Subtract function on Big Number Class

  20. Program to show the implementation of Hashing with Insert, Delete and search functionality using double-ended Linked List

 
 
Didn't find what you were looking for? Find more on Program to create a circular queue