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   <string.h>
 # include   <stdlib.h>
 # include    <conio.h>

 int top=-1;

 char Stack[25][100]={NULL};

 void push(const char *);
 const char* pop( );

 void postfix_to_infix(const char *);

 int main( )
    {
       clrscr( );

       char Postfix_expression[100]={NULL};

       cout<<\"\\n\\n\\t Enter the Postfix Expression : \";
       cin.getline(Postfix_expression,80);

       postfix_to_infix(Postfix_expression);

       getch( );
       return 0;
    }



 //-----------------------------  push(const char)  ----------------------//


 void push(const char *Symbol)
    {
       if(top==24)
      cout<<\"Error : Stack is full.\"<<endl;

       else
      {
         top++;
         strcpy(Stack[top],Symbol);
      }
    }


 //--------------------------------  pop( )  -----------------------------//


 const char* pop( )
    {
       char Symbol[100]={NULL};

       if(top==-1)
      cout<<\"Error : Stack is empty.\"<<endl;

       else
      {
         strcpy(Symbol,Stack[top]);
         strset(Stack[top],NULL);
         top--;
      }

       return Symbol;
    }


 //---------------------  postfix_to_infix(const char *)  ----------------//


 void postfix_to_infix(const char *Postfix)
    {
       char Infix_expression[100]={NULL};
       char Postfix_expression[100]={NULL};

       strcpy(Postfix_expression,Postfix);
       strcat(Postfix_expression,\"=\");

       int count=0;

       char Symbol_scanned[5]={NULL};

       do
      {
         Symbol_scanned[0]=Postfix_expression[count];

         if(Symbol_scanned[0]==\'/\' || Symbol_scanned[0]==\'*\' ||
        Symbol_scanned[0]==\'-\' || Symbol_scanned[0]==\'+\' ||
                       Symbol_scanned[0]==\'^\' )
        {
           char Value_1[100]={NULL};
           char Value_2[100]={NULL};
           char Result[100]={NULL};

           strcpy(Value_1,pop( ));
           strcpy(Value_2,pop( ));

           if(Infix_expression[(count+1)]!=\'=\')
              strcpy(Result,\"(\");

           strcat(Result,Value_2);
           strcat(Result,Symbol_scanned);
           strcat(Result,Value_1);

           if(Infix_expression[(count+1)]!=\'=\')
              strcat(Result,\")\");

           push(Result);
        }

         else
        push(Symbol_scanned);

         count++;
      }
       while(Postfix_expression[count]!=\'=\');

       strset(Infix_expression,NULL);
       strcpy(Infix_expression,pop( ));

       cout<<\"\\n\\n\\t Infix Expression is : \"<<Infix_expression;
    }

    Related Post:
  1. Program to estimate the Integral value of the function at the given points from the given data using Simpsons 1/3 Rule

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

  3. Program of Shortest Path for Given Source and Destination (using Dijkstras Algo.)

  4. Program of SCANNER

  5. Program of declaration of default arguments during creation of function

  6. Program to print a histogram

  7. Program to construct Newtons Forward Difference Interpolation Formula from the given distinct equally spaced data points

  8. Program to draw a circle using Polynomial Method

  9. Program to illustrate the binary operator(-) overloading without creating an object of that class

  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. Write a Program to create Numeric Triangle

  12. Program to determine whether the given function is a Cubic Spline or not

  13. CREATING A CLASS ACCOUNTS FROM WHICH ARE DERIVED TWO CLASSES CURRENT AND SAVINGS AND THEN ASK THE USER FOR THE TYPE OF ACCOUNT HE WANTS TO CREATE

  14. Program to show a 3D object using Polygon-Mesh Representation

  15. Program to illustrate the multi-level inheritance

  16. Program that provides an example of destructors

  17. Program to illustrate the implementation of arrays as a Linear Queue ( in graphics )

  18. Program to implement Lexical Analyzer

  19. Program to show the 3D Shearing Transformation along x-axis

  20. Program using cout statement to display in single line

 
 
Didn't find what you were looking for? Find more on Program to convert a Postfix Expression into an Infix Expression