Showing posts with label cplusplus. Show all posts
Showing posts with label cplusplus. Show all posts
on Sunday, 2 February 2014
 # include <iostream.h>
 # include <graphics.h>
 # include    <conio.h>
 # include     <math.h>


 # define  f                 0.3
 # define  projection_angle   45


 void show_screen( );

 void apply_rotation_along_x_axis(constint [5][3],constint);
 void multiply_matrices(constfloat[4],constfloat[4][4],float[4]);

 void draw_pyramid(int [5][3]);
 void get_projected_point(int&,int&,int&);

 void Line(constint,constint,constint,constint);


 int main( )
    {
       int driver=VGA;
       int mode=VGAHI;

       initgraph(&driver,&mode,"..\\Bgi");

       show_screen( );

       int pyramid[5][3]={
                {280,130,50},      //  base front left
                {360,130,50},      //  base front right
                {360,130,-50},     //  base back right
                {280,130,-50},     //  base back left
                {320,20,0}        //  top
             };

      setcolor(15);
     draw_pyramid(pyramid);

       setcolor(15);
       settextstyle(0,0,1);
     outtextxy(50,415,"*** Use + & - Keys to apply Rotation along x-axis.");

       int angle=0;
       int key_code=0;

       char Key=NULL;

       do
      {
         Key=NULL;
         key_code=0;

         Key=getch( );
         key_code=int(Key);

         if(key_code==0)
        {
           Key=getch( );
           key_code=int(Key);
        }

         if(key_code==27)
        break;

         elseif(key_code==43)
        angle-=5;

         elseif(key_code==45)
        angle+=5;

         setfillstyle(1,0);
           bar(40,70,600,410);

         apply_rotation_along_x_axis(pyramid,angle);
      }
       while(1);

       return 0;
    }

 /*************************************************************************//*************************************************************************///------------------------  Funcion Definitions  ------------------------///*************************************************************************//*************************************************************************//*************************************************************************///-------------------  apply_rotation_along_x_axis( )  ------------------///*************************************************************************/void apply_rotation_along_x_axis(constint control_points[5][3],
                                constint theta)
    {
       int edge_points[5][3]={0};

       float angle=(theta*(M_PI/180));

       for(int count=0;count<5;count++)
      {
         edge_points[count][0]=control_points[count][0];
         edge_points[count][1]=control_points[count][1];
         edge_points[count][2]=control_points[count][2];

         float matrix_a[4]={edge_points[count][0],edge_points[count][1],
                            edge_points[count][2],1};
         float matrix_b[4][4]={
                    { 1,0,0,0 } ,
                    { 0,cos(angle),sin(angle),0 } ,
                    { 0,-sin(angle),cos(angle),0 } ,
                    { 0,0,0,1 }
                  };
         float matrix_c[4]={0};

         multiply_matrices(matrix_a,matrix_b,matrix_c);

         edge_points[count][0]=(int)(matrix_c[0]+0.5);
         edge_points[count][1]=(int)(matrix_c[1]+0.5);
         edge_points[count][2]=(int)(matrix_c[2]+0.5);
      }

       setcolor(10);
     draw_pyramid(edge_points);
    }

 /************************************************************************///----------------------  multiply_matrices( )  ------------------------///************************************************************************/void multiply_matrices(constfloat matrix_1[4],
                  constfloat matrix_2[4][4],float matrix_3[4])
    {
       for(int count_1=0;count_1<4;count_1++)
      {
         for(int count_2=0;count_2<4;count_2++)
        matrix_3[count_1]+=
               (matrix_1[count_2]*matrix_2[count_2][count_1]);
      }
    }

 /************************************************************************///--------------------------  draw_pyramid( )  -------------------------///************************************************************************/void draw_pyramid(int points[5][3])
    {
       int edge_points[5][3];

       for(int i=0;i<5;i++)
      {
         edge_points[i][0]=points[i][0];
         edge_points[i][1]=points[i][1];
         edge_points[i][2]=points[i][2];

         get_projected_point(edge_points[i][0],
                    edge_points[i][1],edge_points[i][2]);

         edge_points[i][1]+=240;
      }

       Line(edge_points[0][0],edge_points[0][1],
                      edge_points[1][0],edge_points[1][1]);
       Line(edge_points[1][0],edge_points[1][1],
                      edge_points[2][0],edge_points[2][1]);
       Line(edge_points[2][0],edge_points[2][1],
                      edge_points[3][0],edge_points[3][1]);
       Line(edge_points[3][0],edge_points[3][1],
                      edge_points[0][0],edge_points[0][1]);

       Line(edge_points[0][0],edge_points[0][1],
                      edge_points[4][0],edge_points[4][1]);
       Line(edge_points[1][0],edge_points[1][1],
                      edge_points[4][0],edge_points[4][1]);
       Line(edge_points[2][0],edge_points[2][1],
                      edge_points[4][0],edge_points[4][1]);
       Line(edge_points[3][0],edge_points[3][1],
                      edge_points[4][0],edge_points[4][1]);
    }

 /************************************************************************///---------------------  get_projected_point( )  -----------------------///************************************************************************/void get_projected_point(int& x,int& y,int& z)
    {
       float fcos0=(f*cos(projection_angle*(M_PI/180)));
       float fsin0=(f*sin(projection_angle*(M_PI/180)));

       float Par_v[4][4]={
                {1,0,0,0},
                {0,1,0,0},
                {fcos0,fsin0,0,0},
                {0,0,0,1}
             };

       float xy[4]={x,y,z,1};
       float new_xy[4]={0};

       multiply_matrices(xy,Par_v,new_xy);

       x=(int)(new_xy[0]+0.5);
       y=(int)(new_xy[1]+0.5);
       z=(int)(new_xy[2]+0.5);
    }

 /*************************************************************************///-------------------------------  Line( )  -----------------------------///*************************************************************************/void Line(constint x_1,constint y_1,constint x_2,constint y_2)
    {
       int color=getcolor( );

       int x1=x_1;
       int y1=y_1;

       int x2=x_2;
       int y2=y_2;

       if(x_1>x_2)
      {
         x1=x_2;
         y1=y_2;

         x2=x_1;
         y2=y_1;
      }

       int dx=abs(x2-x1);
       int dy=abs(y2-y1);
       int inc_dec=((y2>=y1)?1:-1);

       if(dx>dy)
      {
         int two_dy=(2*dy);
         int two_dy_dx=(2*(dy-dx));
         int p=((2*dy)-dx);

         int x=x1;
         int y=y1;

         putpixel(x,y,color);

         while(x<x2)
        {
           x++;

           if(p<0)
              p+=two_dy;

           else
              {
             y+=inc_dec;
             p+=two_dy_dx;
              }

           putpixel(x,y,color);
        }
      }

       else
      {
         int two_dx=(2*dx);
         int two_dx_dy=(2*(dx-dy));
         int p=((2*dx)-dy);

         int x=x1;
         int y=y1;

         putpixel(x,y,color);

         while(y!=y2)
        {
           y+=inc_dec;

           if(p<0)
              p+=two_dx;

           else
              {
             x++;
             p+=two_dx_dy;
              }

           putpixel(x,y,color);
        }
      }
    }

 /*************************************************************************///--------------------------  show_screen( )  ---------------------------///*************************************************************************/void show_screen( )
    {
       setfillstyle(1,1);
     bar(210,26,420,38);

       settextstyle(0,0,1);
     setcolor(15);
       outtextxy(5,5,"******************************************************************************");
       outtextxy(5,17,"*-**************************************************************************-*");
       outtextxy(5,29,"*-----------------------                             ------------------------*");
       outtextxy(5,41,"*-**************************************************************************-*");
       outtextxy(5,53,"*-**************************************************************************-*");

     setcolor(11);
       outtextxy(218,29,"3D Rotation along X-axis");

     setcolor(15);

       for(int count=0;count<=30;count++)
          outtextxy(5,(65+(count*12)),"*-*                                                                        *-*");

       outtextxy(5,438,"*-**************************************************************************-*");
       outtextxy(5,450,"*-------------------------                          -------------------------*");
       outtextxy(5,462,"******************************************************************************");

     setcolor(12);
       outtextxy(229,450,"Press any Key to exit.");
    }
on Monday, 20 January 2014
#include<iostream.h>
 #include<conio.h>

 int largest(int,int,int);

 main()
    {
       clrscr();


       int value_1;
       int value_2;
       int value_3;
       int maximum;

       cout<<"\n Enter the value_1 =  ";
       cin>>value_1;

       cout<<"\n Enter the value_2 =  ";
       cin>>value_2;

       cout<<"\n Enter the value_3 =  ";
       cin>>value_3;

       maximum=largest(value_1,value_2,value_3);

       cout<<"\n The largest integer is = "<<maximum<<endl;

       getch();
       return 0;
    }

 /*************************************************************************///-------------------------  largest(int,int,int)  ----------------------///*************************************************************************/int largest(int x,int y,int z)
    {
       int largest=x;

       if(y>largest)
      largest=y;

       if(z>largest)
      largest=z;

       return largest;
    }
# include <iostream.h>
 # include <graphics.h>
 # include    <conio.h>
 # include     <math.h>

 # define  f                 0.3
 # define  projection_angle   45

 void show_screen( );

 void Bezier_curve(constint,constint [4][3]);
 void Piece_wise_bezier_curve(constint,constint [25][3]);

 double nCr(int,int);
 double factorial(int);

 void get_projected_point(double&,double&,double&);
 void multiply_matrices(constfloat[4],constfloat[4][4],float[4]);

 void Dashed_line(constint,constint,constint,constint,constint=0);


 int main( )
    {
       int driver=VGA;
       int mode=VGAHI;

       int n;

       do
      {
         show_screen( );

         gotoxy(8,10);
         cout<<"Number of Control Points : n :";

         gotoxy(8,11);
         cout<<"ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ";

         gotoxy(12,13);
         cout<<"Enter the value of n (1<n<=25) = ";
         cin>>n;

         if(n>=10)
        n=10;

         int control_points[25][3]={0};

         for(int count=0;count<n;count++)
        {
           gotoxy(8,16);
           cout<<"Coordinates of Point-"<<count<<" (x"<<count<<",y"<<count<<",z"<<count<<") :";

           gotoxy(8,17);
           cout<<"ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ";

           gotoxy(12,19);
           cout<<"Enter the value of x"<<count<<" = ";
           cin>>control_points[count][0];

           gotoxy(12,21);
           cout<<"Enter the value of y"<<count<<" = ";
           cin>>control_points[count][1];

           gotoxy(12,23);
           cout<<"Enter the value of z"<<count<<" = ";
           cin>>control_points[count][2];

           gotoxy(8,16);
           cout<<"                                            ";

           gotoxy(12,19);
           cout<<"                                            ";

           gotoxy(12,21);
           cout<<"                                            ";

           gotoxy(12,23);
           cout<<"                                            ";
        }

         initgraph(&driver,&mode,"..\\Bgi");

         setcolor(15);
           Piece_wise_bezier_curve(n,control_points);

         setcolor(15);
           outtextxy(110,460,"Press <Enter> to continue or any other key to exit.");

         int key=int(getch( ));

         if(key!=13)
        break;
      }
       while(1);

       return 0;
    }

void Piece_wise_bezier_curve(constint n,constint cpts[25][3])
    {
       int pieces=(n/4);
       int extra_points=(n%4);

       int point=1;

       int cp[4][3]={0};

       for(int count_1=0;count_1<pieces;count_1++)
      {
         point--;

         for(int count_2=0;count_2<4;count_2++)
        {
           cp[count_2][0]=cpts[point][0];
           cp[count_2][1]=cpts[point][1];
           cp[count_2][2]=cpts[point][2];

           point++;
        }

         Bezier_curve(3,cp);
      }

       if(extra_points)
      {
         for(int count_3=(point-1),count_4=0;count_3<n;
                            count_3++,count_4++)
        {
           cp[count_4][0]=cpts[count_3][0];
           cp[count_4][1]=cpts[count_3][1];
           cp[count_4][2]=cpts[count_3][2];
        }

         Bezier_curve(extra_points,cp);
      }
    }

void Bezier_curve(constint n,constint cp[4][3])
    {
       setcolor(7);

       double x_1;
       double y_1;
       double z_1;
       double x_2;
       double y_2;
       double z_2;

       for(int count=0;count<n;count++)
      {
         x_1=cp[count][0];
         y_1=cp[count][1];
         z_1=cp[count][2];
         x_2=cp[(count+1)][0];
         y_2=cp[(count+1)][1];
         z_2=cp[(count+1)][2];

         get_projected_point(x_1,y_1,z_1);
         get_projected_point(x_2,y_2,z_2);

         Dashed_line((int)(x_1+0.5),(int)(y_1+0.5),
                         (int)(x_2+0.5),(int)(y_2+0.5));
      }

       double x;
       double y;
       double z;

       for(float u=0.0005;u<=1;u+=0.0005)
      {
         x=0;
         y=0;
         z=0;

         for(int k=0;k<=n;k++)
        {
           x+=(cp[k][0]*nCr(n,k)*pow(u,k)*powl((1-u),(n-k)));
           y+=(cp[k][1]*nCr(n,k)*pow(u,k)*powl((1-u),(n-k)));
           z+=(cp[k][2]*nCr(n,k)*pow(u,k)*powl((1-u),(n-k)));
        }

         get_projected_point(x,y,z);

         putpixel((int)(x+0.5),(int)(y+0.5),15);
      }
    }

double nCr(int n,int r)
    {
       double nf;
       double rf;
       double nrf;
       double ncr;

       nf=factorial(n);
       rf=factorial(r);
       nrf=factorial((n-r));

       ncr=(nf/(rf*nrf));

       return ncr;
    }

double factorial(int number)
    {
       double factorial=1;

       if(number==0 || number==1);

       else
      {
         for(int count=1;count<=number;count++)
        factorial=factorial*count;
      }

       return factorial;
    }

void get_projected_point(double& x,double& y,double& z)
    {
       float fcos0=(f*cos(projection_angle*(M_PI/180)));
       float fsin0=(f*sin(projection_angle*(M_PI/180)));

       float Par_v[4][4]={
                {1,0,0,0},
                {0,1,0,0},
                {fcos0,fsin0,0,0},
                {0,0,0,1}
             };

       float xy[4]={x,y,z,1};
       float new_xy[4]={0};

       multiply_matrices(xy,Par_v,new_xy);

       x=new_xy[0];
       y=new_xy[1];
       z=new_xy[2];
    }

void multiply_matrices(constfloat matrix_1[4],
                  constfloat matrix_2[4][4],float matrix_3[4])
    {
       for(int count_1=0;count_1<4;count_1++)
      {
         for(int count_2=0;count_2<4;count_2++)
        matrix_3[count_1]+=
               (matrix_1[count_2]*matrix_2[count_2][count_1]);
      }
    }

void Dashed_line(constint x_1,constint y_1,constint x_2,
                      constint y_2,constint line_type)
    {
       int count=0;
       int color=getcolor( );

       int x1=x_1;
       int y1=y_1;

       int x2=x_2;
       int y2=y_2;

       if(x_1>x_2)
      {
         x1=x_2;
         y1=y_2;

         x2=x_1;
         y2=y_1;
      }

       int dx=abs(x2-x1);
       int dy=abs(y2-y1);
       int inc_dec=((y2>=y1)?1:-1);

       if(dx>dy)
      {
         int two_dy=(2*dy);
         int two_dy_dx=(2*(dy-dx));
         int p=((2*dy)-dx);

         int x=x1;
         int y=y1;

         putpixel(x,y,color);

         while(x<x2)
        {
           x++;

           if(p<0)
              p+=two_dy;

           else
              {
             y+=inc_dec;
             p+=two_dy_dx;
              }

           if((count%2)!=0 && line_type==0)
              putpixel(x,y,color);

           elseif((count%5)!=4 && line_type==1)
              putpixel(x,y,color);

           elseif((count%10)!=8 && (count%10)!=9 && line_type==2)
              putpixel(x,y,color);

           elseif((count%20)!=18 && (count%20)!=19 && line_type==3)
              putpixel(x,y,color);

           elseif((count%12)!=7 && (count%12)!=8 &&
                (count%12)!=10 && (count%12)!=11 && line_type==4)
              putpixel(x,y,color);

           count++;
        }
      }

       else
      {
         int two_dx=(2*dx);
         int two_dx_dy=(2*(dx-dy));
         int p=((2*dx)-dy);

         int x=x1;
         int y=y1;

         putpixel(x,y,color);

         while(y!=y2)
        {
           y+=inc_dec;

           if(p<0)
              p+=two_dx;

           else
              {
             x++;
             p+=two_dx_dy;
              }

           if((count%2)!=0 && line_type==0)
              putpixel(x,y,color);

           elseif((count%5)!=4 && line_type==1)
              putpixel(x,y,color);

           elseif((count%10)!=8 && (count%10)!=9 && line_type==2)
              putpixel(x,y,color);

           elseif((count%20)!=18 && (count%20)!=19 && line_type==3)
              putpixel(x,y,color);

           elseif((count%12)!=7 && (count%12)!=8 &&
                (count%12)!=10 && (count%12)!=11 && line_type==4)
              putpixel(x,y,color);

           count++;
        }
      }
    }

void show_screen( )
    {
       restorecrtmode( );
       clrscr( );
       textmode(C4350);

       cprintf("\n********************************************************************************");
       cprintf("*-***********************-                           -************************-*");
       cprintf("*------------------------- ");

       textbackground(1);
       cprintf(" Piece-Wise Bezier Curve ");
       textbackground(8);

       cprintf(" --------------------------*");
       cprintf("*-***********************-                           -************************-*");
       cprintf("*-****************************************************************************-*");

       for(int count=0;count<42;count++)
      cprintf("*-*                                                                          *-*");

       gotoxy(1,46);
       cprintf("*-****************************************************************************-*");
       cprintf("*------------------------------------------------------------------------------*");
       cprintf("********************************************************************************");

       gotoxy(1,2);
    }

#include<iostream.h>
#include<conio.h>
void kal(int *a,int *b)
{
    int *temp,i;
    temp=&i;
    *temp=*a;
    *a=*b;
    *b=*temp;
}

main()
{
    clrscr();
    int i=5,j=10;
    cout<<"Before swapping I = "<<i<<" J = "<<j<<endl;
    kal(&i,&j);
    cout<<"After swapping I = "<<i<<" J = "<<j<<endl;
}
# include <iostream.h>
 # include   <stdlib.h>
 # include   <string.h>
 # include    <stdio.h>
 # include    <conio.h>
 # include     <math.h>

 constint max_size=13;

 int n=0;
 int top=-1;
 int choice=0;

 longdouble h=0;
 longdouble x0=0;

 longdouble xn[max_size]={0};
 longdouble fx[max_size]={0};

 char Fx[100]={NULL};
 char D3fx[100]={NULL};
 char Stack[30][30]={NULL};
 char Postfix_expression[2][30][30]={NULL};

void push(constchar *);
 void convert_ie_to_pe(constchar *,constint);

 constchar* pop( );
 constlongdouble evaluate_postfix_expression(constlongdouble,constint);

 void show_screen( );
 void clear_screen( );
 void get_input( );
 void estimate_dfx( );

 constint get_index(constlongdouble);

int main( )
    {
       clrscr( );
       textmode(C4350);

       show_screen( );
       get_input( );
       estimate_dfx( );

       return 0;
     }

void show_screen( )
    {
       cprintf("\n********************************************************************************");
       cprintf("*************************-                             -************************");
       cprintf("*------------------------- ");

       textbackground(1);
       cprintf(" Numerical Differentiation ");
       textbackground(8);

       cprintf(" ------------------------*");
       cprintf("*-***********************-                             -**********************-*");
       cprintf("*-****************************************************************************-*");

       for(int count=0;count<42;count++)
      cprintf("*-*                                                                          *-*");

       gotoxy(1,46);
       cprintf("*-****************************************************************************-*");
       cprintf("*------------------------------------------------------------------------------*");
       cprintf("********************************************************************************");

       gotoxy(1,2);
    }

void clear_screen( )
    {
       for(int count=0;count<37;count++)
      {
         gotoxy(5,8+count);
         cout<<"                                                                        ";
      }

       gotoxy(1,2);
    }

void push(constchar* Operand)
    {
       if(top==(max_size-1))
      {
         cout<<"Error : Stack is full."<<endl;
         cout<<"\n        Press any key to exit.";

         getch( );
         exit(0);
      }

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

constchar* pop( )
    {
       char Operand[40]={NULL};

       if(top==-1)
      {
         cout<<"Error : Stack is empty."<<endl;
         cout<<"\n        Press any key to exit.";

         getch( );
         exit(0);
      }

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

       return Operand;
    }

void convert_ie_to_pe(constchar* Expression,constint index)
    {
       char Infix_expression[100]={NULL};
       char Symbol_scanned[30]={NULL};

       push("(");
       strcpy(Infix_expression,Expression);
       strcat(Infix_expression,"+0)");

       int flag=0;
       int count_1=0;
       int count_2=0;
       int equation_length=strlen(Infix_expression);

       if(Infix_expression[0]=='(')
      flag=1;

       do
      {
         strset(Symbol_scanned,NULL);

         if(flag==0)
        {
           int count_3=0;

           do
              {
             Symbol_scanned[count_3]=Infix_expression[count_1];

             count_1++;
             count_3++;
              }
           while(count_1<=equation_length &&
               Infix_expression[count_1]!='(' &&
                  Infix_expression[count_1]!='+' &&
                 Infix_expression[count_1]!='-' &&
                    Infix_expression[count_1]!='*' &&
                       Infix_expression[count_1]!='/' &&
                      Infix_expression[count_1]!='^' &&
                         Infix_expression[count_1]!=')');


           flag=1;
        }

         elseif(flag==1)
        {
           Symbol_scanned[0]=Infix_expression[count_1];

           count_1++;

           if(Infix_expression[count_1]!='(' &&
             Infix_expression[count_1]!='^' &&
                Infix_expression[count_1]!='*' &&
                   Infix_expression[count_1]!='/' &&
                  Infix_expression[count_1]!='+' &&
                     Infix_expression[count_1]!='-' &&
                    Infix_expression[count_1]!=')')
              flag=0;

           if(Infix_expression[count_1-1]=='(' &&
               (Infix_expression[count_1]=='-' ||
                 Infix_expression[count_1]=='+'))
              flag=0;
        }

         if(strcmp(Symbol_scanned,"(")==0)
        push("(");

         elseif(strcmp(Symbol_scanned,")")==0)
        {
           while(strcmp(Stack[top],"(")!=0)
              {
             strcpy(Postfix_expression[index][count_2],pop( ));

             count_2++;
              }

           pop( );
        }

         elseif(strcmp(Symbol_scanned,"^")==0 ||
               strcmp(Symbol_scanned,"+")==0 ||
                 strcmp(Symbol_scanned,"-")==0 ||
                       strcmp(Symbol_scanned,"*")==0 ||
                         strcmp(Symbol_scanned,"/")==0)
        {
           if(strcmp(Symbol_scanned,"^")==0)
              {  }

           elseif(strcmp(Symbol_scanned,"*")==0 ||
                          strcmp(Symbol_scanned,"/")==0)
              {
             while(strcmp(Stack[top],"^")==0 ||
                     strcmp(Stack[top],"*")==0 ||
                       strcmp(Stack[top],"/")==0)
                {
                   strcpy(Postfix_expression[index][count_2],pop( ));

                   count_2++;
                }
              }

           elseif(strcmp(Symbol_scanned,"+")==0 ||
                    strcmp(Symbol_scanned,"-")==0)
              {
             while(strcmp(Stack[top],"(")!=0)
                {
                   strcpy(Postfix_expression[index][count_2],pop( ));

                   count_2++;
                }
              }

           push(Symbol_scanned);
        }

         else
        {
           strcat(Postfix_expression[index][count_2],Symbol_scanned);

           count_2++;
        }
      }
       while(strcmp(Stack[top],NULL)!=0);

       strcat(Postfix_expression[index][count_2],"=");
       count_2++;
    }

constlongdouble evaluate_postfix_expression(
                    constlongdouble x,constint index)
    {
       longdouble function_value=0;

       int count_1=-1;

       char Symbol_scanned[30]={NULL};

       do
      {
         count_1++;

         strcpy(Symbol_scanned,Postfix_expression[index][count_1]);

         if(strcmp(Symbol_scanned,"^")==0 ||
              strcmp(Symbol_scanned,"*")==0 ||
                strcmp(Symbol_scanned,"/")==0 ||
                  strcmp(Symbol_scanned,"+")==0 ||
                    strcmp(Symbol_scanned,"-")==0)

        {
           char Result[30]={NULL};
           char Operand[2][30]={NULL};

           strcpy(Operand[0],pop( ));
           strcpy(Operand[1],pop( ));

           longdouble operand[2]={0};
           longdouble result=0;

           char *endptr;

           for(int count_2=0;count_2<2;count_2++)
              {
             int flag=0;

             if(Operand[count_2][0]=='-')
                {
                   int length=strlen(Operand[count_2]);

                   for(int count_3=0;count_3<(length-1);count_3++)
                  Operand[count_2][count_3]=Operand[count_2][(count_3+1)];

                   Operand[count_2][count_3]=NULL;

                   flag=1;
                }

             if(strcmp(Operand[count_2],"x")==0)
                operand[count_2]=x;

             elseif(strcmp(Operand[count_2],"e")==0)
                operand[count_2]=2.718282;

             elseif(strcmp(Operand[count_2],"sinx")==0)
                operand[count_2]=sinl(x);

             elseif(strcmp(Operand[count_2],"cosx")==0)
                operand[count_2]=cosl(x);

             elseif(strcmp(Operand[count_2],"tanx")==0)
                operand[count_2]=tanl(x);

             elseif(strcmp(Operand[count_2],"lnx")==0)
                operand[count_2]=logl(x);

             elseif(strcmp(Operand[count_2],"logx")==0)
                operand[count_2]=log10l(x);

             else
                operand[count_2]=strtod(Operand[count_2],&endptr);

             if(flag)
                operand[count_2]*=-1;
              }

           switch(Symbol_scanned[0])
              {
             case'^' : result=powl(operand[1],operand[0]);
                    break;

             case'*' : result=operand[1]*operand[0];
                    break;

             case'/' : result=operand[1]/operand[0];
                    break;

             case'+' : result=operand[1]+operand[0];
                    break;

             case'-' : result=operand[1]-operand[0];
                    break;
              }

           gcvt(result,25,Result);

           push(Result);
        }

         elseif(strcmp(Symbol_scanned,"=")!=0)
        push(Symbol_scanned);
      }
       while(strcmp(Symbol_scanned,"=")!=0);

       char Function_value[30]={NULL};
       char *endptr;

       strcpy(Function_value,pop( ));
       function_value=strtod(Function_value,&endptr);

       return function_value;
    }

void get_input( )
    {
       do
      {
         clear_screen( );

         gotoxy(6,9);
         cout<<"Number of Distinct Data Points :";

         gotoxy(6,10);
         cout<<"ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ";

         gotoxy(27,13);
         cout<<"[ min. n = 7  |  max. n = 12 ]";

         gotoxy(6,12);
         cout<<"Enter the max. number of distinct data points = n = ";

         cin>>n;

         if(n<7 || n>12)
        {
           gotoxy(12,25);
           cout<<"Error : Wrong Input. Press <Esc> to exit or any other key";

           gotoxy(12,26);
           cout<<"        to try again.";

           n=int(getche( ));

           if(n==27)
              exit(0);
        }
      }
       while(n<7 || n>12);

       gotoxy(6,16);
       cout<<"Enter the value of x0 = ";

       cin>>x0;

       gotoxy(6,18);
       cout<<"Enter the value of h = ";

       cin>>h;

       gotoxy(6,24);
       cout<<"Input Mode :";

       gotoxy(6,25);
       cout<<"ÍÍÍÍÍÍÍÍÍÍÍÍ";

       gotoxy(8,28);
       cout<<"Press : ";

       gotoxy(10,30);
       cout<<"- 'Y' or <Enter> to enter function";

       gotoxy(10,32);
       cout<<"- 'N' or <Any other key> to enter values of the function";

       gotoxy(8,35);
       cout<<"Enter your choice : ";

       char Choice=NULL;

       Choice=getch( );

       if(Choice=='y' || Choice=='Y' || int(Choice)==13)
      {
         choice=1;

         gotoxy(28,35);
         cout<<"Y";
      }

       else
      {
         gotoxy(28,35);
         cout<<"N";
      }

       gotoxy(25,43);
       cout<<"Press any key to continue...";

       getch( );

       if(choice)
      {
         clear_screen( );

         gotoxy(6,11);
         cout<<"Non-Linear Function :";

         gotoxy(6,12);
         cout<<"ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ";

         gotoxy(6,37);
         cout<<"Note : Write the function with proper Braces ( ) e.g; 2x+3 as (2*x)+3";

         gotoxy(6,40);
         cout<<"Available Operators  :  ^ (raised to power) , * , / , + , -";

         gotoxy(6,42);
         cout<<"Available Operands   :  x , e , sinx , cosx , tanx , lnx , logx ,";

         gotoxy(6,44);
         cout<<"                        n = any number";

         gotoxy(6,14);
         cout<<"Enter the Function : f(x) = ";

         cin>>Fx;

         gotoxy(6,17);
         cout<<"Enter the Differential Function : f\"'(x) = ";

         cin>>D3fx;

         convert_ie_to_pe(Fx,0);
         convert_ie_to_pe(D3fx,1);
      }

       clear_screen( );

       gotoxy(6,9);
       cout<<"Data Points & Values of Function :";

       gotoxy(6,10);
       cout<<"ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ";

       gotoxy(25,12);
       cout<<"ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿";

       gotoxy(25,13);
       cout<<"³       x       ³     f(x)      ³";

       gotoxy(25,14);
       cout<<"ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´";

       gotoxy(25,15);
       cout<<"³               ³               ³";

       for(int count_1=0;count_1<n;count_1++)
      {
         gotoxy(25,(wherey( )+1));
         cout<<"³               ³               ³";

         gotoxy(25,(wherey( )+1));
         cout<<"³               ³               ³";
      }

       gotoxy(25,(wherey( )+1));
       cout<<"ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ";

       xn[0]=x0;

       for(int count_2=0;count_2<(n-1);count_2++)
      xn[(count_2+1)]=(xn[count_2]+h);

       gotoxy(25,16);

       for(int count_3=0;count_3<n;count_3++)
      {
         gotoxy(27,wherey( ));
         cout<<xn[count_3];

         if(choice)
        {
           fx[count_3]=evaluate_postfix_expression(xn[count_3],0);

           gotoxy(43,wherey( ));
           cout<<fx[count_3];
        }

         else
        {
           gotoxy(43,wherey( ));
           cin>>fx[count_3];
        }

         if(choice)
        gotoxy(25,(wherey( )+2));

         else
        gotoxy(25,(wherey( )+1));
      }

       gotoxy(25,43);
       cout<<"Press any key to continue...";

       getch( );
    }

constint get_index(constlongdouble x)
    {
       for(int count=0;count<n;count++)
      {
         if(xn[count]==x)
        break;
      }

       return count;
    }

 /*************************************************************************///----------------------------  estimate_dfx( )  ------------------------///*************************************************************************/void estimate_dfx( )
    {
       clear_screen( );

       gotoxy(6,9);
       cout<<"Centeral Difference Formula of Order 4 :";

       gotoxy(6,10);
       cout<<"ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ";

       gotoxy(6,13);
       cout<<"f\"'(x) ÷ [-f(x+3h)+8f(x+2h)-13f(x+h)+13f(x-h)-8f(x-2h)+f(x-3h)]/(8h^3)";

       gotoxy(6,17);
       cout<<"Estimation of f\"'(x) :";

       gotoxy(6,18);
       cout<<"ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ";

       char Choice=NULL;

       longdouble x=0;
       longdouble d3fx=0;
       longdouble actual_d3fx=0;

       int error_flag=0;

       do
      {
         Choice=NULL;

         x=0;
         d3fx=0;
         actual_d3fx=0;
         error_flag=0;

         gotoxy(10,20);
         cout<<"Enter the value of x = ";

         cin>>x;

         if(x<=xn[2] || x>=xn[(n-3)])
        {
           error_flag=1;

           gotoxy(10,23);
           cout<<"Error: Please enter x greater than x(2) and less than x(n-2).";
        }

         else
        {
           int index=0;

           index=get_index(x);

           longdouble fxph=fx[(index+1)];
           longdouble fxp2h=fx[(index+2)];
           longdouble fxp3h=fx[(index+3)];
           longdouble fxmh=fx[(index-1)];
           longdouble fxm2h=fx[(index-2)];
           longdouble fxm3h=fx[(index-3)];

           d3fx=((-fxp3h+(8*fxp2h)-(13*fxph)+(13*fxmh)-(8*fxm2h)+fxm3h)/(8*powl(h,3)));

           gotoxy(10,23);
           cout<<"The estimated value of f\"'("<<x<<")  ÷  "<<d3fx;
        }

         if(choice && !error_flag)
        {
           actual_d3fx=evaluate_postfix_expression(x,1);

           gotoxy(10,25);
           cout<<"The Actual value of f\"'("<<x<<")  =  "<<actual_d3fx;

           gotoxy(10,28);
           cout<<"Absolute Error = E(abs) =  "<<fabs((actual_d3fx-d3fx));
        }

         gotoxy(15,42);
         cout<<"Press <Esc> to exit or any other key to continue...";

         Choice=getch( );

         if(int(Choice)!=27)
        {
           gotoxy(10,20);
           cout<<"                                                    ";

           gotoxy(10,23);
           cout<<"                                                              ";

           gotoxy(10,25);
           cout<<"                                                    ";

           gotoxy(10,28);
           cout<<"                                                    ";

           gotoxy(15,42);
           cout<<"                                                    ";
        }

         elseif(int(Choice)==27)
        exit(0);
      }
       while(1);
    }
#include <iostream.h>
#include <fstream.h>
#include <string.h>
#include <iomanip.h>
#include <conio.h>

class phoneBook{
    char name[20],phno[15];
    public:
    void getdata();
    void showdata();
    char *getname(){ return name; }
    char *getphno(){ return phno; }
    void update(char *nm,char *telno){
        strcpy(name,nm);
        strcpy(phno,telno);
    }
};

void phoneBook :: getdata(){
    cout<<"\nEnter Name : ";
    cin>>name;
    cout<<"Enter Phone No. : ";
    cin>>phno;
}

void phoneBook :: showdata(){
    cout<<"\n";
    cout<<setw(20)<<name;
    cout<<setw(15)<<phno;
}


void main(){
    phoneBook rec;
    fstream file;
    file.open("d:\\phone.dat", ios::ate | ios::in | ios::out | ios::binary);
    char ch,nm[20],telno[6];
    int choice,found=0;
    while(1){
        clrscr();
        cout<<"\n*****Phone Book*****\n";
        cout<<"1) Add New Record\n";
        cout<<"2) Display All Records\n";
        cout<<"3) Search Telephone No.\n";
        cout<<"4) Search Person Name\n";
        cout<<"5) Update Telephone No.\n";
        cout<<"6) Exit\n";
        cout<<"Choose your choice : ";
        cin>>choice;
        switch(choice){
            case 1 : //New Record
                 rec.getdata();
                 cin.get(ch);
                 file.write((char *) &rec, sizeof(rec));
                 break;

            case 2 : //Display All Records
                 file.seekg(0,ios::beg);
                 cout<<"\n\nRecords in Phone Book\n";
                 while(file){
                    file.read((char *) &rec, sizeof(rec));
                    if(!file.eof())
                        rec.showdata();
                 }
                 file.clear();
                 getch();
                 break;

            case 3 : //Search Tel. no. when person name is known.
                 cout<<"\n\nEnter Name : ";
                 cin>>nm;
                 file.seekg(0,ios::beg);
                 found=0;
                 while(file.read((char *) &rec, sizeof(rec)))
                 {
                    if(strcmp(nm,rec.getname())==0)
                    {
                        found=1;
                        rec.showdata();
                    }
                 }
                 file.clear();
                 if(found==0)
                    cout<<"\n\n---Record Not found---\n";
                 getch();
                 break;

            case 4 : //Search name on basis of tel. no
                 cout<<"\n\nEnter Telephone No : ";
                 cin>>telno;
                 file.seekg(0,ios::beg);
                 found=0;
                 while(file.read((char *) &rec, sizeof(rec)))
                 {
                    if(strcmp(telno,rec.getphno())==0)
                    {
                        found=1;
                        rec.showdata();
                    }
                 }
                 file.clear();
                 if(found==0)
                    cout<<"\n\n---Record Not found---\n";
                 getch();
                 break;

            case 5 : //Update Telephone No.
                 cout<<"\n\nEnter Name : ";
                 cin>>nm;
                 file.seekg(0,ios::beg);
                 found=0;
                 int cnt=0;
                 while(file.read((char *) &rec, sizeof(rec)))
                 {
                    cnt++;
                    if(strcmp(nm,rec.getname())==0)
                    {
                        found=1;
                        break;
                    }
                 }
                 file.clear();
                 if(found==0)
                    cout<<"\n\n---Record Not found---\n";
                 else
                 {
                    int location = (cnt-1) * sizeof(rec);
                    cin.get(ch);
                    if(file.eof())
                        file.clear();

                    cout<<"Enter New Telephone No : ";
                    cin>>telno;
                    file.seekp(location);
                    rec.update(nm,telno);
                    file.write((char *) &rec, sizeof(rec));
                    file.flush();
                 }
                 break;
            case 6 : gotoout;
        }
    }
out:
file.close();
}[/Code]
on Sunday, 19 January 2014
#include <iostream.h>
#include <stdlib.h>  //for exit()
#include <conio.h>
#include <dos.h>
#define row 7
#define col 5


class revpol{
      int top,rank;
      char *stack_arr,*polish,*infix;
      public:
      int f(char);  //Input precedence functionint g(char);  //Stack precedence functionint r(char);  //rank functionvoid push(char);
      char pop();
      char *concat(char *,char);
      void suffix();//infix to suffix conversion functionvoid printStack();
      void printSuffix();
      void printRank();
      void printInfix(char);
};

void revpol :: printInfix(char ch){
    staticint y=row,x=col;
    gotoxy(x,y++);
    cout<<ch;
}

void revpol :: printStack(){
     staticint x=col,y=row;
     gotoxy(x+10,y++);
     cout<<stack_arr;
}

void revpol :: printSuffix(){
     staticint x=col,y=row;
     gotoxy(x+30,y++);
     cout<<polish;
}

void revpol :: printRank(){
     staticint x=col,y=row;
     gotoxy(x+50,y++);
     cout<<rank;
}

int revpol :: f(char inputchar){
     if(inputchar==')')
      return(0);
     elseif(inputchar=='+' || inputchar=='-')
      return(1);
     elseif(inputchar=='*' || inputchar=='/')
      return(3);
     elseif(inputchar=='^')
      return(6);
     elseif(inputchar>='a' || inputchar<='z')
      return(7);
     elseif(inputchar>='A' || inputchar<='Z')
      return(7);
     elseif(inputchar=='(')
      return(9);
     elsereturn(-99);  //for error
}

int revpol :: g(char inputchar){
     if(inputchar=='(')
      return(0);
     elseif(inputchar=='+' || inputchar=='-')
      return(2);
     elseif(inputchar=='*' || inputchar=='/')
      return(4);
     elseif(inputchar=='^')
      return(5);
     elseif(inputchar>='a' || inputchar<='z')
      return(8);
     elseif(inputchar>='A' || inputchar<='Z')
      return(8);
     elsereturn(-99);  //for error
}


int revpol :: r(char inputchar){
     if(inputchar=='+' || inputchar=='-' || inputchar=='*' || inputchar=='/'|| inputchar=='^')
      return(-1);
     elseif(inputchar>='a' || inputchar<='z')
      return(1);
     elseif(inputchar>='A' || inputchar<='Z')
      return(1);
     elsereturn(-99);  //for error
}


void revpol :: push(char charin){
     top++;
     stack_arr[top]=charin;
     stack_arr[top+1]='\0';
}

char revpol :: pop(){
     char popdata;
     popdata=stack_arr[top];
     stack_arr[top]='\0';
     top--;
     return(popdata);
}

char * revpol :: concat(char *polish,char temp){
     int i;
     for(i=0;polish[i]!='\0';i++);
     polish[i]=temp;
     polish[i+1]='\0';
     return(polish);
}

void revpol :: suffix(){
     int i;
     char next,temp;

     //initialize the stack
     top=0;
     stack_arr[top]='(';

     //Intialize output string and rank count
     polish="";
     rank=0;

     textcolor(LIGHTGREEN);
     gotoxy(2,24);
     cprintf("E-Mail  :  find@myblog.com");
     gotoxy(2,25);
     cprintf("Website :  http://dotnetguts.blogspot.com ");

     gotoxy(1,1);
     textcolor(LIGHTMAGENTA);
     cprintf("*****INFIX TO POSTFIX (Paranthesized)*****\r\n");
     textcolor(WHITE);
     cprintf("Enter Infix string : ");
     cin>>infix;
     infix=concat(infix,')');

     textcolor(LIGHTBLUE);
     gotoxy(2,5);
     cprintf("INFIX");
     gotoxy(15,5);
     cprintf("STACK");
     gotoxy(35,5);
     cprintf("SUFFIX");
     gotoxy(53,5);
     cprintf("RANK");

     gotoxy(15,6);
     cout<<"(";
     cout<<endl;


     //Remove symbols with greater precedence from stackfor(i=0;infix[i]!='\0';i++){
     //obtain next input symbol
     next=infix[i];
     cout<<endl;
     printInfix(next);

     if(top<0){
        cout<<"\n\n\tInvali Infix";
        getch();
        exit(1);
     }
     while(f(next) < g(stack_arr[top])){
           temp=pop();
           polish=concat(polish,temp);
           rank = rank + r(temp);
           if(rank<1){
          cout<<"\n\n\tInvalid Infix";
          getch();
          exit(1);
           }
     }
     //Are there matching parentheses?if(f(next) != g(stack_arr[top]))
         push(next);
     else
         temp=pop();  //here value in temp is of no use
     delay(200);
     printStack();
     printSuffix();
     printRank();
     }


      //Check whether expression is invalidif(rank!=1 || top!=-1){
         textcolor(RED + BLINK);
         cprintf("\r\n\r\nInvalid Infix");
      }
      else{
        textcolor(LIGHTGREEN + BLINK);
        cprintf("\r\n\r\nvalid Infix");
        textcolor(YELLOW);
        cprintf("\r\nSuffix : %s",polish);
      }
      _setcursortype(_NOCURSOR);
}

void main(){
     clrscr();
     revpol obj;
     obj.suffix();
     getch();
}
[/Code]
#include <iostream.h>
#include <conio.h>

class sel_search
{
int d[50],s,search_val;
public:
void getdata(void);
int search(void);
void display(void);
};

void sel_search :: getdata(void)
{
cout<<endl<<endl;
cout<<"How many size of array you want to create:-";
cin>>s;
cout<<"Enter "<<s<<" Integers\n";
for(int i=0;i<s;i++)
    cin>>d[i];
cout<<"\n\nEnter your search:-";
cin>>search_val;
}

int  sel_search :: search(void)
{
for(int i=0;i<s;i++)
{
    if(d[i]==search_val)
           return(i+1);
}
return(-1);
}

void sel_search :: display(void)
{
int result;
cout<<"\n\n\n";
result=search();
if(result==-1)
    cout<<"\nEntered Search is Illegal\n";
else
    cout<<"\nSearch is Located at "<<result<<" Position";
}

void main()
{
clrscr();
sel_search o1;
o1.getdata();
o1.display();
getch();
}
 #include<iostream.h>
 #include<conio.h>


 int year_code(int,int);

 main()
    {
       clrscr();

       int date;
       int year;
       int month;
       int birth_week;
       int century;
       int birth_year;
       int century_remainder;
       int century_code;
       int birth_year_code;
       int day;

       cout<<"\n Enter the date in the following pattern :"<<endl;
       gotoxy(34,3);
       cout<<"Date - Month - Year"<<endl;

       gotoxy(39,4);
       cout<<"-       -       "<<endl;

       gotoxy(35,4);
       cin>>date;

       gotoxy(43,4);
       cin>>month;

       gotoxy(50,4);
       cin>>year;

       century=year/100;
       birth_year=year%100;

       century_remainder=century%4;

       if(century_remainder==0)
      century_code=date-1;

       elseif(century_remainder==1)
      century_code=date-3;

       elseif(century_remainder==2)
      century_code=date-5;

       else
      century_code=date;

       birth_year_code=year_code(birth_year,month);
       birth_week=century_code+birth_year_code;

       cout<<"\n The day on the given date is : ";

       day=birth_week%7;

       switch(day)
      {
         case 0: cout<<"Friday";
             break;

         case 1: cout<<"Saturday";
             break;

         case 2: cout<<"Sunday";
             break;

         case 3: cout<<"Monday";
             break;

         case 4: cout<<"Tuesday";
             break;

         case 5: cout<<"Wednesday";
             break;

         case 6: cout<<"Thursday";
             break;
      }

       getch();
       return 0;
    }

int year_code(int year,int month)
    {
       int code;

       int array_1[12]={3,6,6,2,4,7,2,5,1,3,6,1};
       int array_2[12]={4,7,7,3,5,1,3,6,2,4,7,2};
       int array_3[12]={5,1,1,4,6,2,4,7,3,5,1,3};
       int array_4[12]={6,2,3,6,1,4,6,2,5,7,3,5};
       int array_5[12]={1,4,4,7,2,5,7,3,6,1,4,6};
       int array_6[12]={2,5,5,1,3,6,1,4,7,2,5,7};
       int array_7[12]={3,6,6,2,4,7,2,5,1,3,6,1};
       int array_8[12]={4,7,1,4,6,2,4,7,3,5,1,3};
       int array_9[12]={6,2,2,5,7,3,5,1,4,6,2,4};
       int array_10[12]={7,3,3,6,1,4,6,2,5,7,3,5};
       int array_11[12]={2,3,1,2,4,7,2,5,1,3,6,1};
       int array_12[12]={7,3,4,7,2,5,7,3,6,1,4,6};
       int array_13[12]={5,1,2,5,7,3,5,1,4,6,2,4};
       int array_14[12]={3,6,7,3,5,1,3,6,2,4,7,2};
       int array_15[12]={1,4,5,1,3,6,1,4,7,2,5,7};

       if(year==1 || year==29 || year== 57 || year==85 || year==7 ||
     year==35 || year==63 || year==91 || year==18 || year==46 || year==74)
      code=array_1[month-1];

       elseif(year==2 || year==30 || year== 58 || year==86 || year==13 ||
     year==41 || year==69 || year==97 || year==19 || year==47 || year==75)
      code=array_2[month-1];

       elseif(year==3 || year==31 || year== 59 || year==87 || year==14 ||
     year==42 || year==70 || year==98 || year==25 || year==53 || year==81)
      code=array_3[month-1];

       elseif(year==4 || year==32 || year== 60 || year==88)
      code=array_4[month-12];

       elseif(year==5 || year==33 || year== 61 || year==89 || year==11 ||
     year==39 || year==67 || year==95 || year==22 || year==50 || year==78)
      code=array_5[month-1];

       elseif(year==6 || year==34 || year== 62 || year==90 || year==17 ||
             year==45 || year==73 || year==23 || year==51 || year==79)
      code=array_6[month-1];

       elseif(year==7 || year==35 || year== 63 || year==91)
      code=array_7[month-1];

       elseif(year==8 || year==36 || year==64 || year==92)
      code=array_8[month-1];

       elseif(year==9 || year==37 || year== 65 || year==93 || year==15 ||
     year==43 || year==71 || year==99 || year==26 || year==54 || year==82)
      code=array_9[month-1];

       elseif(year==10 || year==38 || year==66 || year==94 || year==21 ||
             year==49 || year==77 || year==27 || year==55 || year==83)
      code=array_10[month-1];

       elseif(year==12 || year==40 || year==68 || year==96)
      code=array_11[month-1];

       elseif(year==16 || year==44 || year==72 || year==100)
      code=array_12[month-1];

       elseif(year==20 || year==48 || year==76)
      code=array_13[month-1];

       elseif(year==24 || year==52 || year==80)
      code=array_14[month-1];

       elseif(year==28 || year==56 || year==84)
      code=array_15[month-1];

       return code;
    }