on Monday, 24 February 2014
 #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;
    }
on Sunday, 2 February 2014
import java.io.*;


import java.util.*;
/** * * @author Hira */publicclass Filespaths {

    /**     * @param args the command line arguments     */publicstaticvoid main(String[] args) {
        try {
        Path p=Paths.get("C:\\outfile\\outfile.txt");
        System.out.println(p);
        System.out.println(p.toAbsolutePath().toString());
        System.out.println(p.getParent());
        System.out.println(p.getRoot());
        System.out.println(Files.exists(p));
         System.out.println(p.getFileName());
         Files.deleteIfExists(p);
     
       
        } catch (IOException ex) {
            System.err.println(ex.getMessage());
        }
       
    List<Integer> e=Arrays.asList(2,3,5,6,7,8,0);
    List<Integer> f=Arrays.asList(12,13,14,15,16,12,18);
    System.out.println(e);
    System.out.println(f);
    try{
    for(int i=0;i<e.size();i++){
        int o=f.get(i)%e.get(i);
        System.out.println(o);  
    }
    }catch(ArithmeticException g){
        System.err.println("Exception caught :"+g.getMessage());
    }
    }
}
# 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 Dfx[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;
     }


 /*************************************************************************///--------------------------  show_screen( )  ---------------------------///*************************************************************************/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);
    }

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

       gotoxy(1,2);
    }

 /*************************************************************************///--------------------------  push(const char*)  ------------------------///*************************************************************************/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);
      }
    }

 /*************************************************************************///------------------------------  pop( )  -------------------------------///*************************************************************************/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;
    }

 /*************************************************************************///----------------  convert_ie_to_pe(const char*,const int)  ------------///*************************************************************************/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++;
    }

 /*************************************************************************///-----  evaluate_postfix_expression(const long double,const int)  ------///*************************************************************************/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;
    }

 /*************************************************************************///-----------------------------  get_input( )  --------------------------///*************************************************************************/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 = 3  |  max. n = 12 ]";

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

         cin>>n;

         if(n<3 || 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<3 || 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>>Dfx;

         convert_ie_to_pe(Fx,0);
         convert_ie_to_pe(Dfx,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( );
    }

 /*************************************************************************///-------------------  get_index(const long double)  --------------------///*************************************************************************/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 2 :";

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

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

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

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

       char Choice=NULL;

       longdouble x=0;
       longdouble dfx=0;
       longdouble actual_dfx=0;

       int error_flag=0;

       do
      {
         Choice=NULL;

         x=0;
         dfx=0;
         actual_dfx=0;
         error_flag=0;

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

         cin>>x;

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

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

         else
        {
           int index=0;

           index=get_index(x);

           longdouble fxph=fx[(index+1)];
           longdouble fxmh=fx[(index-1)];

           dfx=((fxph-fxmh)/(2*h));

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

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

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

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

         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 <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.");
    }
#include <iostream.h>
#include <stdio.h>
#include <conio.h>
#include <string.h>
#include <ctype.h>
#include <process.h>

int main()
{
    char state = '0';
    char ch = NULL;
    char token[20]={NULL};
    char stt[3][2]= {NULL, '2',
             '0', '1',
             '1', '1'};
    cout<<"Input integer value : ";
    cin>>token;

    for(int i=0; token[i] != NULL; i++)
    {
        if(isdigit(token[i]))
        {
            ch='2';
        }
        else
        {
            printf("Invalide value");
            getchar();
            exit(0);
        }
        for(int j=1; j<3 && ch != stt[0][j]; j++);
        for(int k=1; k<2 && state != stt[k][0]; k++);
        state=stt[k][j];

    }
    printf("Valide value");  
    getchar();
    return 0;
}
#include <iostream.h>
#include <iomanip.h>
#include <conio.h>

class    bank
{
char name[20];
int acno;
char actype[20];
int bal;
public :
void opbal(void);
void deposit(void);
void withdraw(void);
void display(void);
};

void bank :: opbal(void)
{
cout<<endl<<endl;
cout<<"Enter Name :-";
cin>>name;
cout<<"Enter A/c no. :-";
cin>>acno;
cout<<"Enter A/c Type :-";
cin>>actype;
cout<<"Enter Opening Balance:-";
cin>>bal;
}

void bank :: deposit(void)
{
cout<<"Enter Deposit amount :-";
int deposit=0;
cin>>deposit;
deposit=deposit+bal;
cout<<"\nDeposit Balance = "<<deposit;
bal=deposit;
}

void bank :: withdraw(void)
{
int withdraw;
cout<<"\nBalance Amount = "<<bal;
cout<<"\nEnter Withdraw Amount :-";
cin>>withdraw;
bal=bal-withdraw;
cout<<"After Withdraw Balance is "<<bal;
}

void  bank :: display(void)
{
cout<<endl<<endl<<endl;
cout<<setw(50)<<"DETAILS"<<endl;
cout<<setw(50)<<"name      "<<name<<endl;
cout<<setw(50)<<"A/c. No.     "<<acno<<endl;
cout<<setw(50)<<"A/c Type      "<<actype<<endl;
cout<<setw(50)<<"Balance     "<<bal<<endl;
}

void main()
{
clrscr();
bank o1;
int choice;
    do
    {
           cout<<"\n\nChoice List\n\n";
           cout<<"1)  To assign Initial Value\n";
         cout<<"2)  To Deposit\n";
         cout<<"3)  To Withdraw\n";
         cout<<"4)  To Display All Details\n";
         cout<<"5)  EXIT\n";
         cout<<"Enter your choice :-";
         cin>>choice;
         switch(choice)
         {
         case 1: o1.opbal();
                     break;
         case 2: o1.deposit();
                     break;
           case 3: o1.withdraw();
                     break;
         case 4: o1.display();
                     break;
            case 5: goto end;
         }
   }while(1);
end:
}
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;
    }