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
 
 
#include<iostream.h>
#include<stdio.h>
#include<conio.h>

main()
{
    int array[15];
    int no_el;
    clrscr();
    cout<<\"Enter the no of element :\";
    cin>>no_el;
    for(int i=0;i<no_el;i++)
    {
        cout<<\"Enter the element : \";
        cin>>array[i];
    }
    while(1)
    {
        clrscr();
        cout<<endl<<\"1. Append\";
        cout<<endl<<\"2. Insert\";
        cout<<endl<<\"3. delete by value\";
        cout<<endl<<\"4. edit\";
        cout<<endl<<\"5. display\";
        cout<<endl<<\"6. search\";
        cout<<endl<<\"7. exit\";
        cout<<endl<<\"Enter your choice : \";
        int choice;
        cin>>choice;
        switch(choice)
        {
            case 1:
                cout<<\"Enter the new element : \";
                int new_el;
                cin>>new_el;
                array[no_el]=new_el;
                no_el++;
            break;
            case 2:
                cout<<\"Enter the position at which you want to insert : \";
                int pos;
                cin>>pos;
                cout<<\"Enter the new element : \";
                cin>>new_el;
                pos--;
                for(i=no_el-1;i>=pos;i--)
                    array[i+1]=array[i];
                array[pos]=new_el;
                no_el++;
            break;
            case 3:
                cout<<\"Enter the value to be search : \";
                int key;
                cin>>key;
                for(pos=0;pos<no_el;pos++)
                {
                    if(array[pos]==key)
                        break;
                }
                if(pos==no_el)
                {
                    cout<<\"Search key not found\";
                    break;
                }
                for(i=pos;i<no_el;i++)
                    array[i]=array[i+1];
                no_el--;
            break;
            case 4:
                cout<<\"Enter the position to be edit : \";
                cin>>pos;
                cout<<\"Enter the new value for old position : \";
                cin>>array[pos-1];
            break;
            case 5:
                cout<<endl;
                for(i=0;i<no_el;i++)
                    cout<<endl<<\"The element is : \"<<array[i];
            break;
            case 6:
                cout<<\"Enter the value to be search : \";
                cin>>key;
                for(pos=0;pos<no_el;pos++)
                {
                    if(array[pos]==key)
                        break;
                }
                if(pos==no_el)
                {
                    cout<<\"Search key not found\";
                    break;
                }
                cout<<\"Search key found at : \"<<pos+1;
            break;
            case 7:
                return(0);
            break;
        }
        getch();
    }
}

    Related Post:
  1. Program to show the projection of 3D objects using Standard Perspective Projection

  2. Program that take font and background color and text input from a user and display it in right aligned

  3. Program to coumputes and displays the factorial of the given number ( using Recursive Algorithm )

  4. Program that changes an infix expression to a postfix expression according

  5. Program to show the implementation of None-or-All String Clipping Strategy (Text Clipping Example)

  6. Program to illustrate the use of pointer this using header file this.h

  7. Program to illustrate the binary operator(+) overloading without creating a new object

  8. Program to show the implementation of Linked List as a Binary Search Tree

  9. Program to draw a 3D Piece-Wise Bezier Curve of nth degree with Zeroth Order Continuity

  10. Program to estimate the value of Fourth Derivative of the function at the given points from the given data using Central Difference Formula of order 4

  11. Program to draw a line using Parametric equations

  12. Program to draw a Sphere using Parametric Equations

  13. Program to maintain employee information also illustrate virtual class and inheritance

  14. Program to illustrate the use of the break statement

  15. Program to computes the n_th term of the fibonacci series using Divide and Conquer Strategy

  16. Program of displaying product inventory by converting one class to another class

  17. Program to illustrate the use of the continue statement

  18. Program to draw a spiral rotating clockwise at the center of the screen

  19. Program to illustrate an example of Polymorphism

  20. Program of swapping numbers by call by reference