Brain Tumor Detection Using Matlab Project With Source Code

ABSTRACT
          Image processing is an active research area in which medical image processing is a highly challenging field. Medical imaging techniques are used to image the inner portions of the human body for medical diagnosis. Brain tumor is a serious life altering disease condition. Image segmentation plays a significant role in image processing as it helps in the extraction of suspicious regions from the medical images. In this paper we have proposed segmentation of brain MRI image using K-means clustering algorithm followed by morphological filtering which avoids the mis-clustered regions that can inevitably be formed after segmentation of the brain MRI image for detection of tumor location. In this paper, we present a system based on gabor filter based enhancement technique and feature extraction techniques using texture based segmentation and SOM (Self Organization Map) which is a form of Artificial Neural Network (ANN) used to analyze the texture features extracted. SOM determines which texture feature has the ability to classify benign, malignant and normal cases. Watershed segmentation technique is used to classify cancerous region from the non cancerous region.

PROJECT OUTPUT

Contact:  
Mr. Roshan P. Helonde
Mobile / WhatsApp:+91-7276355704
Share:

A SECURE AND ROBUST HIGH QUALITY STEGANOGRAPHY SCHEME USING ALPHA CHANNEL Full Matlab Project With Source Code

ABSTRACT
                      Steganography is going to gain its importance due to the exponential growth and secret communication of potential computer users over the internet. It can also be defined as the study of invisible communication that usually deals with the ways of hiding the existence of the communicated message. Generally data embedding is achieved in communication, image, text, voice or multimedia content for copyright, military communication, authentication and many other purposes. In image Steganography, secret communication is achieved to embed a message into cover image (used as the carrier to embed message into) and generate a stego-image (generated image which is carrying a hidden message). Steganography is the art or practice of concealing a message, image, or file within another message, image, or file. It is the art and science of communicating in such a way that the presence of a message cannot be detected. Generally, the hidden messages will appear to be (or be part of) something else: images, articles, shopping lists, or some other cover text. For example, the hidden message may be in invisible ink between the visible lines of a private letter. In this paper we proposed Steganography based on alpha channel.


PROJECT OUTPUT 




Contact:  
Mr. Roshan P. Helonde
Mobile / WhatsApp:+91-7276355704

Share:

EIGEN VALUE BASED RUST DEFECT DETECTION AND EVALUATION OF STEEL COATING CONDITIONS Full Matlab Project

ABSTRACT
PSNR is one of the most often and universally used method for measuring quality of image. In this paper we propose a methodology for assessment of coating condition of bridge images. The defect recognition algorithm includes conversion of captured images into grey level; these grey level images are grouped into defective & non defective group. Further that is processed to plot correspondence map. The correspondence map is measure of matching image. Straight line with 450 in correspondence map indicates no defect in scene image. In contrast if correspondence map produces nonlinear image it indicates defect (rust) in scene image. The nonlinear shape of grey level distribution in correspondence map can be analyzed by calculating Eigen values. Two similar images will produce smaller Eigen value (approximately zero), whereas it will be distinctly large for dissimilar images. The PSNR determines proportion of rust in scene image with relation to reference image.
PROJECT OUTPUT


Contact:  
Mr. Roshan P. Helonde
Mobile / WhatsApp:+91-7276355704
Share:

License Number Plate Recognition By Neural Networks and Image Processing Full Matlab Project With Source Code

ABSTRACT
                      The road becomes more pervasive, our country's road transport development, because of rapid labor management has not filled with actual needs, microelectronics, communications and computer technology in the transport sector of the application has greatly improved the traffic management efficiency. car license plates for automatic identification technology has been widely applied. car license plates automatically identify the entire process is divided into pre-processing, edge extraction, License Plate Positioning, character segmentation and character recognition 5 module, which character recognition process mainly consists of the following three components: 1) correctly to split text image area; 2) correct separation of a single text; 3) correctly identify a single character. The MATLAB software programming to achieve each and every part, and finally identify the license plate of a car. In the study of the same in which the issue of a concrete analysis, and processing. vehicle license plate recognition system as a whole is the main vehicle positioning and character recognition made up of two parts, one license plate positioning and can be divided into image pre-processing and edge extraction module and the licensing of the positioning and segmentation module; character recognition can be divided into character segmentation and feature extraction and a single character recognition two modules.

PROJECT OUTPUT

Contact:  
Mr. Roshan P. Helonde
Mobile / WhatsApp:+91-7276355704
Share:

C Program To Display Dialog Box

#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <dos.h>

union REGS i,o;
char *dbox,*yes_up,*no_up,*yes_down,*no_down,*icon;

void DrawDialogBox(void);
void DialogBox(void);
int initmouse(void);
void showmouseptr(void);
void hidemouseptr(void);
void getmousepos(int *button,int *x,int *y);

void main(void)
{
    int gdriver=DETECT,gmode,errorcode;
    initgraph(&gdriver, &gmode, "..//bgi");
    errorcode=graphresult();
    if(errorcode!=grOk)
    {
        printf("Graphics not initialized");
        printf("Error Status : %s",grapherrormsg(errorcode));
        getche();
        exit(1);
    }
    if(!initmouse())
    {
        printf("Mouse driver can't be loaded");
        getche();
        exit(1);
    }
    DrawDialogBox();
    showmouseptr();
    setbkcolor(BROWN);
    DialogBox();
}

void DrawDialogBox(void)    //    actual drawing of dialog box
{
    int area;
    int poly[10];
    struct textsettingstype textinfo;
    gettextsettings(&textinfo);
    settextstyle(0,HORIZ_DIR,1);
    setfillstyle(1,BLUE);
    bar(200,160,400,235);
    setcolor(7);
    outtextxy(205,163,"Message");           //title bar
    setfillstyle(1,7);
    bar(200,175,400,250);
    bar(388,162,398,172);
    setcolor(WHITE);
    line(388,162,398,162);
    line(388,162,388,172);
    setcolor(5);
    line(388,172,398,172);
    line(398,162,398,172);
    setcolor(7);
    setcolor(8);
    outtextxy(390,164,"X");                 //close button
    outtextxy(260,190,"  Exit ?");           //message
    setcolor(WHITE);
    line(200,160,400,160);
    line(200,160,200,250);
    setcolor(8);                  //outside normal look
    line(400,160,400,250);
    line(200,250,400,250);
    setfillstyle(1,BLUE);
    outtextxy(243,223,"Yes");         //button text
    outtextxy(337,223,"No");
    setcolor(LIGHTBLUE);
    setcolor(WHITE);
    line(230,215,280,215);
    line(230,215,230,238);
    line(320,215,370,215);
    line(320,215,320,238);

    setcolor(8);
    line(280,215,280,238);
    line(230,238,280,238);

    line(370,215,370,238);
    line(320,238,370,238);
    poly[0] = 100;
    poly[1] = 100;
    poly[2] = 90;
    poly[3] = 122;
    poly[4] = 110;
    poly[5] = 122;
    poly[6] = poly[0];
    poly[7] = poly[1];
    setcolor(YELLOW);
    setfillstyle(1,7);
    bar(89,99,111,123);
    setfillstyle(1,YELLOW);
    fillpoly(4, poly);
    setcolor(8);
    settextstyle(4,0,1);
    outtextxy(98,100,"!");
    setcolor(WHITE);
    area=imagesize(89,99,111,123);
    icon=malloc(area);
    getimage(89,99,111,123,icon);
    putimage(89,99,icon,XOR_PUT);
    putimage(210,180,icon,COPY_PUT);
    setfillstyle(1,BLUE);
    settextstyle(0,HORIZ_DIR,1);
    setcolor(WHITE);
    area=imagesize(198,158,402,252);
    dbox=malloc(area);
    getimage(198,158,402,252,dbox);
    putimage(198,158,dbox,XOR_PUT);
    putimage(198,158,dbox,XOR_PUT);

    area=imagesize(230,215,280,238);
    yes_up=malloc(area);
    getimage(230,215,280,238,yes_up);
    putimage(230,215,yes_up,XOR_PUT);
    putimage(230,215,yes_up,XOR_PUT);

    area=imagesize(320,215,370,238);
    no_up=malloc(area);
    getimage(320,215,370,238,no_up);
    putimage(320,215,no_up,XOR_PUT);
    putimage(320,215,no_up,XOR_PUT);

    setcolor(8);
    line(230,215,280,215);
    line(230,215,230,238);

    line(320,215,370,215);
    line(320,215,320,238);

    setcolor(WHITE);
    line(280,215,280,238);
    line(230,238,280,238);

    line(370,215,370,238);
    line(320,238,370,238);

    area=imagesize(230,215,280,238);
    yes_down=malloc(area);
    getimage(230,215,280,238,yes_down);
    putimage(230,215,yes_down,XOR_PUT);
    putimage(230,215,yes_down,XOR_PUT);

    area=imagesize(320,215,370,238);
    no_down=malloc(area);
    getimage(320,215,370,238,no_down);
    putimage(320,215,no_down,XOR_PUT);
    putimage(320,215,no_down,XOR_PUT);

    putimage(320,215,no_up,COPY_PUT);
    putimage(230,215,yes_up,COPY_PUT);
    settextstyle(textinfo.font,0,textinfo.charsize);
}

void DialogBox(void)       //Event Handler for dialog box
{
    int button,x,y,in1=0,in2=0;
    struct textsettingstype textinfo;
    cleardevice();
    putimage(198,158,dbox,XOR_PUT);
    showmouseptr();
    gettextsettings(&textinfo);
    settextstyle(0,HORIZ_DIR,1);
    while(1)
    {
        getmousepos(&button,&x,&y);
        if(x>=388&&x<=398&&y>=162&&y<=172)
        {
            if((button&1)==1)
            {
                while((button&1)==1)
                    getmousepos(&button,&x,&y);
                hidemouseptr();                    //close button click
                cleardevice();
                settextstyle(textinfo.font,0,textinfo.charsize);
                hidemouseptr();
                cleardevice();
                showmouseptr();
                DialogBox();
                break;
            }
        }
        getmousepos(&button,&x,&y);
        if(x>=230&&x<=280&&y>=215&&y<=238)
        {
            if((button&1)==1)
            {
                while((button&1)==1)
                {
                    getmousepos(&button,&x,&y);
                    if(x>=230&&x<=280&&y>=215&&y<=238)
                    {
                        if(in1==1) continue;
                        hidemouseptr();
                        putimage(230,215,yes_down,COPY_PUT);
                        showmouseptr();
                        in1=1;
                    }                                    //yes button click
                    else
                    {
                        if(in1==0)
                            continue;
                        hidemouseptr();
                        putimage(230,215,yes_up,COPY_PUT);
                        showmouseptr();
                        in1=0;
                    }
                }
                if(x>=230&&x<=280&&y>=215&&y<=238)
                {
                    closegraph();
                    restorecrtmode();
                    exit(0);
                }
            }
        }
        if(x>=320&&x<=370&&y>=215&&y<=238)
        {
            if((button&1)==1)
            {
                while((button&1)==1)
                {
                    getmousepos(&button,&x,&y);
                    if(x>=320&&x<=370&&y>=215&&y<=238)
                    {
                        if(in2==1) continue;
                        hidemouseptr();
                        putimage(320,215,no_down,COPY_PUT);
                        showmouseptr();
                        in2=1;
                    }
                    else                                 //no button click
                    {
                        if(in2==0)
                            continue;
                        hidemouseptr();
                        putimage(320,215,no_up,COPY_PUT);
                        showmouseptr();
                        in2=0;
                    }
                }
                getmousepos(&button,&x,&y);
                if(x>=320&&x<=370&&y>=215&&y<=238)
                {
                    hidemouseptr();
                    cleardevice();
                    settextstyle(textinfo.font,0,textinfo.charsize);
                    hidemouseptr();
                    cleardevice();
                    showmouseptr();
                    DialogBox();
                }
            }
        }
    }
}

//    Mouse Functions

int initmouse(void)
{
    i.x.ax=0;
    int86(0x33,&i,&o);
    return (o.x.ax);
}

void showmouseptr(void)
{
    i.x.ax=1;
    int86(0x33,&i,&o);
}

void hidemouseptr(void)
{
    i.x.ax=2;
    int86(0x33,&i,&o);
}

void getmousepos(int *button,int *x,int *y)
{
    i.x.ax=3;
    int86(0x33,&i,&o);
    *button=o.x.bx;
    *x=o.x.cx;
    *y=o.x.dx;
}


Share:

C Program For Graphical Calculator

#include"graphics.h"
#include"dos.h"
#include"stdio.h"
#include"math.h"
union REGS i,o;
char *text[]={ "7","8","9","*","4","5","6","/","1","2","3","+","0","00",".","-","M","M+","M-","+/-","MR","MC","x^2","sr","OFF","AC","CE","="};
int k=0,pass,op,prop,newnum=1,bt,memo=1,d=0,sq;
long double num=0,accum,m;

void normalbutton(int ,int ,int ,int,char**);

void main()

{
    int gd=DETECT,gm,x1,x2,y1,y2,i,j,maxx,maxy,x,y,button;
    char *text1[]={"\"","T","o"," ","K","n","o","w"," ","a","b","o","u","t"," ","m","e"," ","l","o","g","o","n"," ",":"};

    initgraph(&gd,&gm,"..//bgi");
    if(initmouse()==0)
     {
          closegraph();
          restorecrtmode();
          printf("Mouse driver not loded");
          exit(1);
    }
  showmouseptr();
//  x=y=50;
 movemouseptr(&x,&y);
setbkcolor(8);
setcolor(1);
rectangle(198,140,417,163);
rectangle(199,141,418,164);
rectangle(197,139,416,162);
rectangle(185,130,430,450);
rectangle(184,129,431,451);
rectangle(182,127,433,454);
rectangle(181,126,434,453);


//setfillstyle(SOLID_FILL,3);
//bar(200,142,415,161);

outtextxy(200,50,"A Calculator");
outtextxy(200,100,"Press OFF button to exit....");
y1=140;
y2=160;

    for(j=0;j<7;j++)
 {
  x1=200;
  x2=235;
  y1+=40;
  y2+=40;

   for(i=0;i<4;i++)
  {
   normalbutton(x1,x2,y1,y2,text);
   x1+=60;
   x2+=60;
   }
 }


 while(1)
  {


    getmousepos(&button,&x,&y);


    y1=140;
    y2=160;

    for(j=0;j<7;j++)
 {
  x1=200;
  x2=235;
  y1+=40;
  y2+=40;

   for(i=0;i<4;i++)
  {

     if((x<x2&&x>x1)&&(y<y2&&y>y1))
   {
    if((button & 1)==1)
     {  gotoxy(28,10);

    bt=j*4+i;

    setcolor(11);
    outtextxy(x1+12,y1+7,text[j*4+i]);

    if(num>pow(10.0,18))
    exit();
    sound(500);delay(10);nosound();
    delay(250);
    sound(400);delay(10);
    nosound();
     switch (bt)
     {
     case  8 :
       addnum(1);
       break;
     case  9 :
       addnum(2);
       break;
     case  10 :
       addnum(3);
       break;
     case  4 :
       addnum(4);
       break;
     case  5 :
       addnum(5);
       break;
     case  6 :
       addnum(6);
       break;
     case  0 :
       addnum(7);
       break;
     case  1 :
       addnum(8);
       break;
     case  2 :
       addnum(9);
       break;
     case  12 :
       addnum(0);
       break;
     case  11 :
       // plus
       operation(1);
       break;

     case  15 :
       // minus
       operation(2);
       break;
     case  3 :
       // multiplication
       operation(3);
       break;
     case  7 :
       // division
       operation(4);
       break;
     case 13:
       doublezero();
       break;
     case  14 :
       decimal();
       break;

     case 16:
       mem();
       break;
     case 20:
       recallmem();
       break;
     case 19:
       plusminus();
       break;
     case 17:
       plusm();
       break;
     case 18:
       minusm();
       break;
     case 21:
       clearm();
       break;
     case 22 :
       square();
       break;
     case 23:

       sqroot();
       break;
     case 24:
      // OFF
       hidemouseptr();
       setcolor(1);
       for(j=0;j<20;j++)
     {
    for(i=75;i<481;i+=20)

       line(0,0+i+j,640,j+0+i);

       delay(100);
     }
       setcolor(14);
       outtextxy(225,200,"Thanks for using it !");
       delay(2000);
       setcolor(13);
    for(j=0;j<20;j++)
     {
    for(i=0;i<640;i+=20)

       line(0+i+j,0,j+0+i,640);

       delay(100);
     }
       setcolor(1);

       for(i=0;i<25;i++)
      {
    outtextxy(75+10*i,200,text1[i]);
       sound(3000);
       delay(50);
       nosound();
      }
       for(i=0;i<29;i++)
      {

       sound(3000);
       delay(50);
       nosound();
      }
      outtextxy(200,225,"www.enggedu.com/source/");

       delay(2500);
       sound(5000);
       delay(10);
       exit();
       break;
     case 25:
      allclear();
      break;

     case 26:
      clear();
      break;

     case 27:
     //  equalto
       operation(5);
       break;



     }
     setcolor(1);
    outtextxy(x1+12,y1+7,text[j*4+i]);

     }
   }
    x1+=60;
    x2+=60;

   }

 }

  }



}

void normalbutton(int x1,int x2,int y1,int y2,char **text)
{
setcolor(15);
rectangle(x1-2,y1-2,x2+1,y2+1);
rectangle(x1-1,y1-1,x2+2,y2+2);
setcolor(7);
rectangle(x1,y1,x2+2,y2+2);
rectangle(x1,y1,x2+1,y2+1);

setfillstyle(SOLID_FILL,14);
bar(x1,y1,x2,y2);
setcolor(1);
outtextxy(x1+12,y1+7,text[k]);
k++;
}
/* initmouse */
initmouse()
{
 i.x.ax=0;
 int86 (0x33,&i,&o);
 return(o.x.ax);
}
hidemouseptr()
{
     i.x.ax=2;
     int86(0x33,&i,&o);
}

/* displays mouse pointer */
showmouseptr()
{
 i.x.ax=1;
 int86(0x33,&i,&o);
 return 0;
}

/*gets mouse coordinates and button status*/

getmousepos(int *button,int *x,int *y)
{
 i.x.ax=3;
 int86(0x33,&i,&o);
 *button=o.x.bx;
 *x=o.x.cx;
 *y=o.x.dx;
 return 0;
}
/* Move mouse ptr to x,y */
movemouseptr(int *x,int *y)
{
 i.x.ax=4;
 int86(0x33,&i,&o);
 o.x.cx=*x;
 o.x.dx=*y;
 return 0;
}

addnum(int pass)
{   if(sq)
    newnum=1;

    if(newnum)
      {      if(d)
    {
      num=pass/(pow(10.0,d));
      d++;
      newnum=0;
    }
     else
    {  num=pass;
       newnum=0;
    }
      }
    else
    {
    /*  if(num==0)
      {    if(d)
    {
      num=num+pass/(pow(10.0,d));
      d++;
    }
      else
      num=pass;
       }
    */
    //     else
       {    if(d)
    {
       if(num<0)
     num=num-pass/(pow(10.0,d));
       else
     num=num+pass/(pow(10.0,d));
      d++;
    }
    else
    {
    num=num*10+pass;
    }
    }
     }
 printf("%25.5Lf",num);
}

operation(int opr)
{  long double pnum;
   pnum=num;

   if(newnum && (prop != 5) && memo)
   {
   }
   else
  {  newnum=1;
     d=0;
     sq=0;
     switch(prop)
    {
     case 1:
    accum=accum+pnum;
    break;
     case 2:
    accum=accum-pnum;
    break;
     case 3:
    accum=accum*pnum;
    break;
     case 4:
    accum=accum/pnum;
    break;
     default:
       accum=pnum;
     }
  }
    prop=opr;
    num=accum;
 printf("%25.5Lf",num);
}

allclear()
{
 sq=0;
 accum=0;
 num=0;
 d=0;
 newnum=1;
 printf("%25.5Lf",num);
}

mem()
{
 m=num;
}
recallmem()
{
 memo=0;
 printf("%25.5Lf",m);
 num=m;
}
plusminus()
{ if(num!=0)
  {    num*=-1;
    printf("%25.5Lf",num);
  }
}


plusm()
{
m+=num;
}
minusm()
{
m-=num;
}
clearm()
{
m=0;
}
decimal()
{
 if(!d)
  {d=1;
    if(newnum==1)
    {
     num=0;
    }
  printf("%25.5Lf",num);
  }
}

square()
{ sq=1;
 num*=num;
 printf("%25.5Lf",num);
// newnum=1;
}
sqroot()
{ sq=1;
 num=pow(num,0.5);
 printf("%25.5Lf",num);
// newnum=1;
}
doublezero()
{
 if(d)
   {
    // num=num+pass/(pow(100.0,d));
     d++;
     d++;
   }
 else
  num*=100;
 printf("%25.5Lf",num);
}

clear()
{
num=0;
printf("%25.5Lf",num);
}
Share:

C Program To Find Number Of Days Between Two Dates

#include<stdio.h>
#include<math.h>
void main()
{
int day1,mon1,year1,day2,mon2,year2;
int ref,dd1,dd2,i;
clrscr();
printf("\nEnter first day, month, year");
scanf("%d%d%d",&day1,&mon1,&year1);
printf("\nEnter second day,month,year");
scanf("%d%d%d",&day2,&mon2,&year2);
ref = year1;
if(year2<year1)
ref = year2;
dd1=0;
dd1=func1(mon1);
for(i=ref;i<year1;i++)
{
    if(i%4==0)
    dd1+=1;
}
dd1=dd1+day1+(year1-ref)*365;
printf("\nNo. of days of first date fronm the Jan 1 %d= %d",year1,dd1);
/* Count for additional days due to leap years*/
dd2=0;
for(i=ref;i<year2;i++)
{
    if(i%4==0)
    dd2+=1;
}
dd2=func1(mon2)+dd2+day2+((year2-ref)*365);
printf("\nNo. of days from the reference year's first Jan = %d",dd2);
printf("\nTherefore, diff between the two dates is %d",abs(dd2-dd1));

getch();
}




int func1(x)       //x for month y for dd
{  int y=0;
switch(x)
{
case 1: y=0; break;
case 2: y=31; break;
case 3: y=59; break;
case 4: y=90; break;
case 5: y=120;break;
case 6: y=151; break;
case 7: y=181; break;
case 8: y=212; break;
case 9: y=243; break;
case 10:y=273; break;
case 11:y=304; break;
case 12:y=334; break;
default: printf("Error encountered"); exit(1);
}
return(y);
}


Sample Output :
Enter first day, month, year29 7 2009
Enter second day,month,year12 12 2009
No. of days of first date fronm the Jan 1 2009= 210
No. of days from the reference year's first Jan = 346
Therefore, diff between the two dates is 136




Share:

C Program To Convert Digits Into Face Value

#include<stdio.h>
#include<conio.h>
struct std{
            int dig;
            char wrd[20];
               };
struct std fig[]={{1,"one"},{2,"two"},{3,"three"},{4,"four"},{5,"five"},{6,"six"},{7,"seven"},{8,"eight"},{9,"nine"},{10,"ten"},{11,"eleven"},{12,"twelve"},{13,"thirteen"},{14,"fourteen"},{15,"fifteen"},{16,"sixteen"},{17,"seventeen"},{18,"eighteen"},{19,"nineteen"},{20,"twenty"},{30,"thirty"},{40,"fourty"},{50,"fifty"},{60,"sixty"},{70,"seventy"},{80,"eighty"},{90,"ninety"}};
int num1[5],i;
op0(long num)
{
  for(i=0;i<20;i++)
   if(fig[i].dig==num)
    printf("%s",fig[i].wrd);
}
op1(long num)
{ //num1=num;


  num1[0]=num/10;
  num1[0]=num1[0]*10;
  num1[1]=num%10;
  for(i=0;i<27;i++)
  {if(fig[i].dig==num1[0])
    printf("%s ",fig[i].wrd);
  }
  for(i=0;i<20;i++)
  {if(fig[i].dig==num1[1])
    printf("%s",fig[i].wrd);
  }

}
op2(long num)
{
 int k,j=num%100;
 k=num/100;
 for(i=0;i<10;i++)
 {if(fig[i].dig==k)
   {printf("%s hundred ",fig[i].wrd);
    if(j>0&&j<20)
    op0(num%100);
    else
   op1(num%100);
   }
  }
}
op3(long num)
{
 int k,j=num%1000;
 k=num/1000;
 for(i=0;i<10;i++)
 { if(fig[i].dig==k)
   { printf("%s thousand ",fig[i].wrd);
     if(j>=1&&j<10)
     op0(num%1000);
     else if(j>10&&j<100)
     op1(num%1000);
    else
     op2(num%1000);
    }
  }
}
op4(long num)
{
 int k=num/1000,j;
 j=num%1000;
 if(k<=20)
 {
  op0(num/1000);
  printf(" thousand ");
  if(j>0&&j<10)
    op0(num%1000);
    if(j>10&&j<100)
    op1(num%1000);
   else op2(num%1000);
   }
if((k>20)&&(k<100))
{
op1(num/1000);
printf(" thousand ");
if(j>0&&j<10)
  op0(num%1000);
 if(j>10&&j<100)
    op1(num%1000);
else op2(num%1000);
}
//op2(num%1000);
}
op5(long num)
{
 int k=num/100000;
 int j=num%100000;
 for(i=0;i<10;i++)
 { if(fig[i].dig==k)
   { printf("%s lakh ",fig[i].wrd);
     if(j>0&&j<20)
     op0(num%100000);
     if(j>20&&j<100)
     op1(num%100000);
     if(j>100&&j<1000)
     op2(num%100000);
     if(j>1000&&j<10000)
     op3(num%100000);
     if(j>10000&&j<100000)
     op4(num%100000);

    }
  }
}
main()
{
 long num;
 clrscr();
 printf("\n\nEnter the number lessthan one lack\n\n");
 scanf("%ld",&num);
 if(num<=20)
op0(num);
if((num>20)&&(num/100==0))
op1(num);
if(num==100)
printf("hundred");
if(num>100&&num<1000)
op2(num);
if(num==1000) printf("\none thousand");
if(num>1000&&num<10000)
op3(num);
if(num==10000) printf("\nten thousand");
if(num>10000&&num<100000)
op4(num);
if(num==100000) printf("\none lakh");
if(num>100000&&num<1000000)
op5(num);
if(num==1000000)
printf("\nOne crore");
getch();
}

Sample Output :
      Enter the number lessthan one lack
99999
ninety nine thousand nine hundred ninety nine
Share:

C Program For Video Library Management

#include<stdio.h>
#include<conio.h>
#include<dos.h>
#include<string.h>
#include<graphics.h>

#define TBG textbackground(WHITE);textcolor(BLUE)
typedef struct customer
    {
     long id;
     char name[20];
     char pn[12];
     char address[40];
     char category;
     int doj[3];
    }cust;


typedef struct movie
    {
     long id;
     char title[25];
     int copy;
     int cponshelf;
     int issue;
     char sid[20];
     int loc;
    }mov;


typedef struct transaction
    {
     long invoice;
     int doi[3];
     int dor[3];
     char title[25];
     int fine;
     long cid;
     char cname[20];
     int copies;
     int rent;
     int tam;
    }transaction;
cust ctr;
mov mv;
transaction tran;
FILE *fc,*fm,*ft,*tmp;
long int size;
int days,k=0;
struct date d;


void main_menu()
  {
    char *menu[]={"CUSTOMER SECTION",
        "MOVIE SECTION",
        "TRANSACTION SECTION",
        "EXIT"};

    char ch;
    int gd=DETECT,gm,i,choice=0;
    initgraph(&gd,&gm,"..//bgi");
    setfillstyle(SOLID_FILL,RED);
    bar(0,0,640,480);
    title("MAIN MENU",180);
    status();
    box(0,menu[0]);
    box(1,menu[1]);
    box(2,menu[2]);
    box(3,menu[3]);
    selectbox(choice,menu[choice]);

    //72  up
    //80  down
    //75  left
    //77  right
    //13  enter
    //49  1
    //71  Home
    //79  End
    //73 PgUp
    //81 PgDown
    //27 Escape



    while((ch=getch())!=13)
    {
        switch(ch)
        {
        case 80:
        case 81:
        choice++;
        if(choice==4)
        choice=0;
        selectbox(choice,menu[choice]);
        for(i=0;i<=3;i++)
        {
        if(i==choice) continue;
        box(i,menu[i]);
        }
        break;
        case 72:
        case 73:
        choice--;
        if(choice==-1)
        choice=3;
        selectbox(choice,menu[choice]);
        for(i=0;i<=3;i++)
        {
        if(i==choice) continue;
        box(i,menu[i]);
        }
        }
    }

    pressbutton(choice,menu[choice]);

       switch(choice)
      {
        case 0:
           size=sizeof(ctr);
           customer();
           break;
        case 1:
           movie();
           break;
        case 2:
           transactions();
           break;
        case 3:
           closegraph();
           restorecrtmode();
           exit(0);
      }
    }



customer()
{
    char *menu[]={
        "ADD CUSTOMER",
        "MODIFY CUSTOMER",
        "DELETE CUSTOMER",
        "LIST CUSTOMER",
        "BACK TO MAIN MENU",
        "EXIT"
        };

    char ch;
    int gd=DETECT,gm;
    int i,choice=0;
    initgraph(&gd,&gm,"..//bgi");
    setfillstyle(SOLID_FILL,RED);
    bar(0,0,640,480);
    title("CUSTOMER MENU",130);
    status();
    box(0,menu[0]);
    box(1,menu[1]);
    box(2,menu[2]);
    box(3,menu[3]);
    box(4,menu[4]);
    box(5,menu[5]);
    selectbox(choice,menu[choice]);

    //72  up
    //80  down
    //75  left
    //77  right
    //13  enter
    //49  1
    //71  Home
    //79  End
    //73 PgUp
    //81 PgDown
    //27 Escape



    while((ch=getch())!=13)
    {
        switch(ch)
        {
        case 80:
        case 81:
        choice++;
        if(choice==6)
        choice=0;
        selectbox(choice,menu[choice]);
        for(i=0;i<=5;i++)
        {
        if(i==choice) continue;
        box(i,menu[i]);
        }
        break;
        case 72:
        case 73:
        choice--;
        if(choice==-1)
        choice=5;
        selectbox(choice,menu[choice]);
        for(i=0;i<=5;i++)
        {
        if(i==choice) continue;
        box(i,menu[i]);
        }
        }
    }

    pressbutton(choice,menu[choice]);
    closegraph();
    restorecrtmode();

     clrscr();
     if((fc=fopen("c:\customer.txt","rb+"))==NULL)
    fc=fopen("c:\customer.txt","wb+");

     switch(choice)
    {
     case 0:
        addcus();
        break;
    case 1:
        rewind(fc);
        modify();
        break;
     case 2:
        delete();
        break;
     case 3:
        listcust();
        break;
     case 4:
        fclose(fc);
        main_menu();
        break;
     case 5:
        fclose(fc);
        exit(1);
    }
}




movie()
{
    char *menu[]={
        "ADD MOVIE",
        "LIST MOVIES",
        "SEARCH MOVIE",
        "BACK TO MAIN MENU",
        "EXIT"
        };

    char ch;
    int gd=DETECT,gm;
    int i,choice=0;
    initgraph(&gd,&gm,"..//bgi");
    setfillstyle(SOLID_FILL,RED);
    bar(0,0,640,480);
    title("MOVIE MENU",165);
    status();
    box(0,menu[0]);
    box(1,menu[1]);
    box(2,menu[2]);
    box(3,menu[3]);
    box(4,menu[4]);
    selectbox(choice,menu[choice]);

    //72  up
    //80  down
    //75  left
    //77  right
    //13  enter
    //49  1
    //71  Home
    //79  End
    //73 PgUp
    //81 PgDown
    //27 Escape



    while((ch=getch())!=13)
    {
        switch(ch)
        {
        case 80:
        case 81:
        choice++;
        if(choice==5)
        choice=0;
        selectbox(choice,menu[choice]);
        for(i=0;i<=4;i++)
        {
        if(i==choice) continue;
        box(i,menu[i]);
        }
        break;
        case 72:
        case 73:
        choice--;
        if(choice==-1)
        choice=4;
        selectbox(choice,menu[choice]);
        for(i=0;i<=4;i++)
        {
        if(i==choice) continue;
        box(i,menu[i]);
        }
        }
    }

    pressbutton(choice,menu[choice]);
    closegraph();
    restorecrtmode();

     clrscr();
     /*textcolor(4);*/
     fm=fopen("c:\movie.txt","rb+");
     if(fm==NULL)
     fm=fopen("c:\movie.txt","wb+");
     switch(choice)
    {
     case 0:
        addmov();
        break;
     case 1:
        listmov();
        break;
     case 2:
        searchmov();
        break;
     case 3:
        main_menu();
        break;
     case 4:
        fclose(fm);
        exit(1);
    }
}

transactions()
    {
     char *menu[]={
        "NEW TRANSACTION",
        "CLOSE TRANSACTION",
        "LIST TRANSACTIONS",
        "SEARCH MOVIE",
        "BACK TO MAIN MENU",
        "EXIT"
        };

    char ch;
    int gd=DETECT,gm,i,choice=0;
    initgraph(&gd,&gm,"..//bgi");
    setfillstyle(SOLID_FILL,RED);
    bar(0,0,640,480);
    title("TRANSACTION MENU",100);
    status();
    box(0,menu[0]);
    box(1,menu[1]);
    box(2,menu[2]);
    box(3,menu[3]);
    box(4,menu[4]);
    box(5,menu[5]);
    selectbox(choice,menu[choice]);

    //72  up
    //80  down
    //75  left
    //77  right
    //13  enter
    //49  1
    //71  Home
    //79  End
    //73 PgUp
    //81 PgDown
    //27 Escape



    while((ch=getch())!=13)
    {
        switch(ch)
        {
        case 80:
        case 81:
        choice++;
        if(choice==6)
        choice=0;
        selectbox(choice,menu[choice]);
        for(i=0;i<=5;i++)
        {
        if(i==choice) continue;
        box(i,menu[i]);
        }
        break;
        case 72:
        case 73:
        choice--;
        if(choice==-1)
        choice=5;
        selectbox(choice,menu[choice]);
        for(i=0;i<=5;i++)
        {
        if(i==choice) continue;
        box(i,menu[i]);
        }
        }
    }

    pressbutton(choice,menu[choice]);
    closegraph();
    restorecrtmode();

     clrscr();
     ft=fopen("c:\transact.txt","rb+");
     if(ft==NULL)
    ft=fopen("c:\transact.txt","wb+");
     switch(choice)
    {
     case 0:
        addtran();
        break;
     case 1:
        closetran();
        break;
     case 2:
        listtran();
        break;
     case 3:
         fm=fopen("c:\movie.txt","rb+");
         if(fm==NULL)
         fm=fopen("c:\movie.txt","wb+");
         searchmov();
         break;
     case 4:
        main_menu();
        break;
     case 5:
        exit(0);
    }
    }

addcus()
   {
    char another='y';
    fseek(fc,0,SEEK_END);

    TBG;
    while(another=='y'||another=='Y')
    {
     clrscr();
     printf("\n********************   ADD CUSTOMER FORM**********************");
     printf("\nCUSTOMER ID(NUMERIC)  :");
     printf("\nCUSTOMER NAME         :");
     printf("\nCUSTOMER PHONE NO     :");
     printf("\nCUSTOMER ADDRESS      :");
     printf("\nDATE OF JOINING       :");
     printf("\nCATEGORY(H/A/C/R/S/T) :");
     gotorc(2,24);
     customid();
     gotorc(4,24);
     fflush(stdin);
     gets(ctr.name);
     gotorc(6,24);
     fflush(stdin);
     gets(ctr.pn);
     gotorc(8,24);
     fflush(stdin);
     gets(ctr.address);
     gotorc(10,24);
     fflush(stdin);
     getdate(&d);
     ctr.doj[0]=d.da_day;ctr.doj[1]=d.da_mon;ctr.doj[2]=d.da_year;
     printf("\n%d/%d/%d",d.da_day,d.da_mon,d.da_year);
     gotorc(12,24);
     fflush(stdin);
     ctr.category=getche();
     gotorc(16,3);
     printf("\nDO YOU WANT TO SUBMIT THIS FORM (Y/N)");
     fflush(stdin);
     another=getch();
     if(another=='y'||another=='Y')
     fwrite(&ctr,size,1,fc);
     gotorc(18,3);
     printf("\nDO YOU WANT TO ADD ANOTHER CUTOMER(Y/N)");
     fflush(stdin);
     another=getch();
    }
    fclose(fc);
    customer();
     }

customid()
    {
     rewind(fc);
     if(fread(&ctr,sizeof(ctr),1,fc)!=1)
    ctr.id=1;
     else
       {
    while(fread(&ctr,sizeof(ctr),1,fc)==1);
         ctr.id++;
     }
       printf("\n%ld",ctr.id);
     }


 modify()
   {
    char another='y',choice,name[20],flag='n';
    long id;

    TBG;
    while(another=='y'||another=='Y')
    {
     clrscr();
     rewind(fc);
     printf("SEARCH BY NAME : PRESS 1 SEARCH BY ID   : PRESS2");
     fflush(stdin);
     choice=getchar();
     if(choice=='2')
       {
         printf("ENTER CUSTOMER ID : ");
         scanf("%ld",&id);
             while(fread(&ctr,size,1,fc)==1)
               {
        if(ctr.id==id)
         {
          new();
          flag='y';
          break;
         }
              }
         }
     if(choice=='1')
        {
         printf("ENTER CUSTOMER NAME : ");
         fflush(stdin);
         gets(name);
         while(fread(&ctr,size,1,fc)==1)
        {
           if(strcmpi(ctr.name,name)==0)
             {
               new();
               flag='y';
               break;
             }
        }
        }
     if(flag=='n')
     {
     gotorc(15,3);
     printf("CUSTOMER NOT FOUND............ !");
     }
     gotorc(18,3);
     printf("DO YOU WANT TO MODIFY ANOTHER CUTOMER(Y/N)");
     fflush(stdin);
     another=getch();
    }
    fclose(fc);
    customer();
     }




 new()
    {
       char another='y';
       clrscr();
       TBG;
       fseek(fc,-size,SEEK_CUR);
        printf("\nCUSTOMER'S NEW NAME                      :");
        printf("\nCUSTOMER'S NEW PHONE NO                  :");
        printf("\nCUSTOMER'S NEW ADDRESS                   :");
        printf("\nNEW DATE OF JOINING (DD<-|MM<-|YYYY<-|)  :");
        printf("\nNEW CATEGORY(H/A/C/R/S/T)                :");
        gotorc(1,43);
        fflush(stdin);
        gets(ctr.name);
        gotorc(3,43);
        fflush(stdin);
        gets(ctr.pn);
        gotorc(5,43);
        fflush(stdin);
        gets(ctr.address);
        gotorc(7,43);
        fflush(stdin);
        scanf("%d",&ctr.doj[0]);
        gotorc(7,45);
        printf("%c",'/');
        scanf("%d",&ctr.doj[1]);
        gotorc(7,48);
        printf("%c",'/');
        scanf("%d",&ctr.doj[2]);
        gotorc(9,43);
        fflush(stdin);
        ctr.category=getche();
        gotorc(16,3);
        printf("UPDATE THE CUSTOMER RECORD (Y/N)");
        fflush(stdin);
        another=getch();
        if(another=='y'||another=='Y')
        fwrite(&ctr,size,1,fc);
        rewind(fc);
     }





listcust()
      {
      int i=1,p=4;
      clrscr();

          TBG;
      rewind(fc);
      printf("******************************  CUSTOMERS LIST********************************");
      gotorc(2,3);
     printf("ID");
     gotorc(2,8);
     printf("NAME");
     gotorc(2,22);
     printf("PHONE NO");
     gotorc(2,35);
     printf("ADDRESS");
     gotorc(2,55);
     printf("D.O.J");
     gotorc(2,68);
     printf("CATEGORY");
      while(fread(&ctr,size,1,fc)==1)
        {
        gotorc(p,3);
        printf("%ld",ctr.id);
        gotorc(p,8);
        printf("%s",strupr(ctr.name));
        gotorc(p,22);
        printf("%s",ctr.pn);
        gotorc(p,35);
        printf("%s",strupr(ctr.address));
        gotorc(p,55);
        printf("%d/%d/%d",ctr.doj[0],ctr.doj[1],ctr.doj[2]);
        gotorc(p,70);
        printf("%c",toupper(ctr.category));
        if(i%15==0)
        {
        gotorc(40,3);
        printf("PRESS ANY KEY TO CONTINUE.....");
        getch();
        clrscr();
        p=4;
        }
        p+=2;
        i++;

        }
      printf("PRESS ANY KEY TO BACK TO CUSTOMER MENU");
      getch();
      customer();
      }



 delete()
   {
    char another='y',choice,name[20],flag='n';
    long id;
    tmp=fopen("c:\temp.txt","wb");
    rewind(fc);

    TBG;
    while(another=='y'||another=='Y')
    {
     clrscr();
     printf("    DELETE BY NAME : 1 DELETE BY ID  : 2");
     fflush(stdin);
     choice=getchar();
     if(choice=='2')
       {
         printf("ENTER CUSTOMER ID : ");
         scanf("%ld",&id);
         clrscr();
             while(fread(&ctr,size,1,fc)==1)
               {
        if(ctr.id!=id)
          fwrite(&ctr,size,1,tmp);
        else
        flag='y';
              }
         }
     if(choice=='1')
        {
         printf("ENTER CUSTOMER NAME : ");
         fflush(stdin);
         gets(name);
         clrscr();
         while(fread(&ctr,size,1,fc)==1)
        {
           if(strcmpi(ctr.name,name)!=0)
              fwrite(&ctr,size,1,tmp);
           else
        flag='y';
        }
        }
        fclose(fc);
        fclose(tmp);
        remove("c:\customer.txt");
        rename("c:\temp.txt","c:\customer.txt");
     if(flag=='n')
     printf("CUSTOMER NOT FOUND.... !");
     printf("DO YOU WANT TO DELETE ANOTHER CUTOMER(Y/N)");
     fflush(stdin);
     another=getch();
    }
    fclose(fc);
    customer();
     }




 addmov()
   {
    char another='y';

    TBG;
    fseek(fm,0,SEEK_END);
    while(another=='y'||another=='Y')
    {
     clrscr();
     printf("\n**********************ADD MOVIE FORM**************************");
     printf("\nMOVIE ID(NUMERIC)    :");
     printf("\nMOVIE NAME           :");
     printf("\nNO OF COPIES         :");
     printf("\nSUPPLIER ID          :");
     printf("\nLOCATION             :");
     gotorc(1,24);
     movid();
     gotorc(2,24);
     fflush(stdin);
     gets(mv.title);
     gotorc(3,24);
     fflush(stdin);
     scanf("%d",&mv.copy);
     mv.cponshelf=mv.copy;
     mv.issue=0;
     gotorc(4,24);
     fflush(stdin);
     gets(mv.sid);
     gotorc(5,24);
     fflush(stdin);
     scanf("%d",&mv.loc);
     fwrite(&mv,sizeof(mv),1,fm);
     printf("DO YOU WANT TO ADD ANOTHER MOVIE(Y/N)");
     fflush(stdin);
     another=getch();
    }
    fclose(fm);
    printf("PRESS ANY KEY TO BACK TO MOVIE MENU");
    movie();
     }



 movid()
    {
     rewind(fm);
     if(fread(&mv,sizeof(mv),1,fm)!=1)
    mv.id=1;
     else
       {
    while(fread(&mv,sizeof(mv),1,fm)==1);
         mv.id++;
     }
       printf("%ld",mv.id);
    }

 listmov()
      {
      int i=1,p=4;
      textbackground(WHITE);
      textcolor(BLUE);
      clrscr();
      rewind(fm);
      printf("\n******************************  MOVIE LIST********************************");
      gotorc(2,1);
      printf("ID");
      gotorc(2,5);
      printf("TITLE");
      gotorc(2,25);
      printf("TOT_CP");
      gotorc(2,35);
      printf("CP_O_SHELF");
      gotorc(2,48);
      printf("TOT_ISSUES");
      gotorc(2,59);
      printf("SUPPLIER ID");
      gotorc(2,71);
      printf("LOCATION");
      while(fread(&mv,sizeof(mv),1,fm)==1)
        {
        gotorc(p,1);
        printf("%ld",mv.id);
        gotorc(p,5);
        printf("%s",strupr(mv.title));
        gotorc(p,28);
        printf("%d",mv.copy);
        gotorc(p,40);
        printf("%d",mv.cponshelf);
        gotorc(p,52);
        printf("%d",mv.issue);
        gotorc(p,59);
        printf("%s",mv.sid);
        gotorc(p,74);
        printf("%d",mv.loc);
        if(i%10==0)
        {
        printf("PRESS ANY KEY TO CONTINUE.....");
        fflush(stdin);
        getch();
        clrscr();
        p=4;
        }
        i++;
        p+=2;

        }
      printf("PRESS ANY KEY TO BACK TO MOVIE MENU");
      getch();
      fclose(fm);
      movie();
      }



 searchmov()
    {
     char mname[20],another;

     TBG;
     clrscr();
     rewind(fm);
     gotorc(5,5);
     printf("ENTER MOVIE TITLE    :   ");
     fflush(stdin);
     gets(mname);
     while(fread(&mv,sizeof(mv),1,fm)==1)
        {
        if(strcmpi(mv.title,mname)==0)
        {
        gotorc(7,12);
        textcolor(0);
        cprintf("MOVIE FOUND..");
        textcolor(4);
        gotorc(9,5);
        printf("MOVIE TITLE            : %s",mv.title);
        gotorc(11,5);
        printf("TOTAL NO OF COPIES     : %d",mv.copy);
        gotorc(13,5);
        printf("NO OF COPIES AVAILABLE : %d",mv.cponshelf);
        gotorc(15,5);
        printf("SUPPLIER ID            : %s",mv.sid);
        gotorc(17,5);
        printf("LOCATION               : %d",mv.loc);
        gotorc(20,5);
        printf("DO YOU WANT TO SEARCH MORE MOVIES(Y/N)");
        fflush(stdin);
        another=getchar();
        if(another=='y'||another=='Y')
        searchmov();
        fclose(fm);
        movie();
        }
        }

    gotorc(7,5);
    textcolor(4);
    cprintf("MOVIE NOT FOUND.....!");
    textcolor(4);
    gotorc(12,5);
    printf("DO YOU WANT TO SEARCH MORE MOVIES(Y/N)");
    fflush(stdin);
    another=getchar();
    if(another=='y'||another=='Y')
    searchmov();
    fclose(fm);
    movie();

    }


addtran()
   {
    char another='y',rec;

    TBG;
    fseek(ft,0,SEEK_END);
    while(another=='y'||another=='Y')
    {
     clrscr();
     printf("\n************************  TRANSACTION*************************");
     printf("\nINVOICE NO(NUMERIC) :");
     printf("\nMOVIE TITLE         :");
     printf("\nCOPIES AVAILABLE    :");
     printf("CUSTOMER ID         :");
     printf("CUSTOMER NAME       :");
     printf("NO. OF COPIES       :");
     printf("DATE OF ISSUE       :");
     gotorc(2,24);
     invoice();
     gotorc(4,24);
     fflush(stdin);
     gets(tran.title);
     gotorc(6,24);
     avail();
     gotorc(8,24);
     fflush(stdin);
     scanf("%ld",&tran.cid);
     custcheck();
     gotorc(12,24);
     fflush(stdin);
     scanf("%d",&tran.copies);
     if(tran.copies>mv.cponshelf)
        {
        gotorc(18,3);
        printf("\nTRANSACTION NOT POSSIBLE :REQUIRED NO OF COPIES NOTAVAILABLE");
        printf("\nPRESS ANY KEY TO BACK TO TRANSACTION MENU");
        getch();
        transactions();
        }
     gotorc(14,24);
     fflush(stdin);
     getdate(&d);
     tran.doi[0]=d.da_day;tran.doi[1]=d.da_mon;tran.doi[2]=d.da_year;
     printf("\n%d/%d/%d",d.da_day,d.da_mon,d.da_year);
     tran.dor[0]=0;
     tran.rent=0;
     gotorc(18,4);
     printf("\nDO YOU WANT TO RECORD THIS TRANSACTION(Y/N)");
     rec=getchar();
     if(rec=='y'||rec=='Y')
        {
        update();
        fwrite(&tran,sizeof(tran),1,ft);
        }
     printf("\nDO YOU WANT TO ADD ANOTHER TRANSACTION(Y/N)");
     fflush(stdin);
     another=getch();
    }
    fclose(ft);
    printf("\nPRESS ANY KEY TO BACK TO TRANSACTION MENU");
    transactions();
     }


 custcheck()
    {

    if((fc=fopen("c:\customer.txt","rb"))==NULL)
        fc=fopen("c:\customer.txt","wb+");
    rewind(fc);
     while(fread(&ctr,sizeof(ctr),1,fc)==1)
        {
           if(ctr.id==tran.cid)
        {
         gotorc(10,24);
         printf("%s",ctr.name);
         strcpy(tran.cname,ctr.name);
         fclose(fc);
         return;
         }
        }
     fclose(fc);
     gotorc(18,4);
     printf("\nINVALID CUSTOMER ............!");
     gotorc(21,4);
     printf("\nPRESS ANY KEY TO BACK TO TRANSACTION MENU");
     getch();
     transactions();

     }




 invoice()
    {
     rewind(ft);
     if(fread(&tran,sizeof(tran),1,ft)!=1)
    tran.invoice=1;
     else
       {
    while(fread(&tran,sizeof(tran),1,ft)==1);
         tran.invoice++;
     }
       printf("%ld",tran.invoice);
     }



 avail()
    {
     fm=fopen("c:\movie.txt","rb+");
     if(fm==NULL)
     fm=fopen("c:\movie.txt","wb+");
     while(fread(&mv,sizeof(mv),1,fm)==1)
    {
    if(strcmpi(tran.title,mv.title)==0)
        {
        printf("%d",mv.cponshelf);
        fclose(fm);
        return;
        }
    }
     gotorc(18,3);
     printf("%s","\nMOVIE NOT FOUND...!");
     gotorc(21,3);
     printf("\nPRESS ANY KEY TO RETURN");
     getch();
     fclose(fm);
     transactions();
     }





 update()
    {
    long msize;
    msize=sizeof(mv);
     fm=fopen("c:\movie.txt","rb+");
     if(fm==NULL)
     fm=fopen("c:\movie.txt","wb+");
     while(fread(&mv,sizeof(mv),1,fm)==1)
    {
    if(strcmpi(tran.title,mv.title)==0)
        {
        mv.cponshelf=mv.cponshelf-tran.copies;
        mv.issue=mv.issue+tran.copies;
        fseek(fm,-msize,SEEK_CUR);
        fwrite(&mv,sizeof(mv),1,fm);
        break;
        }
    }
     fclose(fm);
     return;
     }



listtran()
      {
      int i=1;

          TBG;
          clrscr();
      rewind(ft);
      while(fread(&tran,sizeof(tran),1,ft)==1)
        {
        printf("\nINVOICE NO(NUMERIC) : %ld",tran.invoice);
        printf("CUSTOMER ID         : %ld",tran.cid);
        printf("CUSTOMER NAME       : %s",tran.cname);
        printf("MOVIE TITLE         : %s",tran.title);
        printf("NO. OF COPIES       : %d",tran.copies);
        printf("DATE OF ISSUE       :%d/%d/%d",tran.doi[0],tran.doi[1],tran.doi[2]);
        if(tran.dor[0]!=0)
        {
        printf("DATE OF RETURN      :%d/%d/%d",tran.dor[0],tran.dor[1],tran.dor[2]);
        printf("RENT                : %d",tran.rent);
        printf("FINE                : %d",tran.fine);
        printf("TOTAL AMOUNT        : %d",tran.tam);
        }

printf("..................................................................");
        if(i%2==0)
        {
        printf("PRESS ANY KEY TO CONTINUE.....");
        getch();
        clrscr();
        }
        i++;

        }
      fclose(ft);
      printf("PRESS ANY KEY TO BACK TO TRANSACTION MENU");
      getch();
      transactions();
      }




 closetran()
    {
     long id,sz;

         TBG;
     clrscr();
     sz=sizeof(tran);
     printf("ENTER INVOICE NO: ");
     scanf("%ld",&id);
     clrscr();
     while(fread(&tran,sz,1,ft)==1)
        {
        if(tran.invoice==id)
        {
        if(tran.dor[0]!=0)
        {
        gotorc(4,4);
        printf("THIS TRANSACTION IS ALL READY CLOSED...!");
        gotorc(7,4);
        printf("PRESS ANY KEY TO BACK TO TRANSACTION MENU......");
        getch();
        transactions();
        }
        fseek(ft,-sz,1);
        getdate(&d);
        tran.dor[0]=d.da_day;tran.dor[1]=d.da_mon;tran.dor[2]=d.da_year;
        difference();
        tran.rent=tran.copies*25;
        if(k==0)
        tran.fine=0;
        else
        tran.fine=tran.copies*(k-1)*5;
        tran.tam=tran.rent+tran.fine;
        printf("INVOICE NO(NUMERIC) : %ld",tran.invoice);
        printf("CUSTOMER ID         : %ld",tran.cid);
        printf("CUSTOMER NAME       : %s",tran.cname);
        printf("MOVIE TITLE         : %s",tran.title);
        printf("NO. OF COPIES       : %d",tran.copies);
        printf("DATE OF ISSUE       :%d/%d/%d",tran.doi[0],tran.doi[1],tran.doi[2]);
        printf("DATE OF RETURN      :%d/%d/%d    ",tran.dor[0],tran.dor[1],tran.dor[2]);
        printf("RENT                : %d",tran.rent);
        printf("FINE                : %d",tran.fine);
        printf("TOTAL AMOUNT        : %d",tran.tam);
        updateclose();
        fwrite(&tran,sz,1,ft);
        fclose(ft);
               }
        }
      printf("PRESS ANY KEY TO BACK TO TRANSACTION MENU");
      getch();
      transactions();

    }


difference()
    {
     int t,m1,m2,y1,y2,d1,d2;
     d1=tran.doi[0];
     d2=tran.dor[0];
     m1=tran.doi[1];
     m2=tran.dor[1];
     y1=tran.doi[2];
     y2=tran.dor[2];
     t=m1;
     if(y2>y1)
       {
       while(y2>y1)
    {
     while(m1<=12)
          {
           check(m1,y1);
           if(m1==t)
          k=days-d1;
           else
         k=k+days;
           m1=m1+1;
          }
      m1=1;y1++;
     }
     while(m1<m2)
       {
    check(m1,y1);
    k=k+days;
    m1++;
       }
     k=k+d2;
  }
  else
    {
     if(m1!=m2)
    {
    while(m1<m2)
          {
           check(m1,y1);
           if(m1==t)
          k=days-d1;
           else
         k=k+days;
           m1=m1+1;
          }
        k=k+d2;
     }
     else
    k=d2-d1;
    }

  }



check(int m1,int y1)
   {
    if(m1==1||m1==3||m1==5||m1==7||m1==8||m1==10||m1==12)
       days=31;
    else
    {
    if(m1!=2)
       days=30;
      else
        {
         if(y1%4==0)
        days=29;
         else
        days=28;
         }
     }
    }



 updateclose()
    {
     long msize;
    msize=sizeof(mv);
     fm=fopen("c:\movie.txt","rb+");
     if(fm==NULL)
     fm=fopen("c:\movie.txt","wb+");
     while(fread(&mv,sizeof(mv),1,fm)==1)
    {
    if(strcmpi(tran.title,mv.title)==0)
        {
        mv.cponshelf=mv.cponshelf+tran.copies;
        fseek(fm,-msize,SEEK_CUR);
        fwrite(&mv,msize,1,fm);
        break;
        }
    }
     fclose(fm);
     return;
     }

 gotorc(int r,int c)
    {
     union REGS i,o;
     i.h.ah=2;
     i.h.bh=0;
     i.h.dh=r;
     i.h.dl=c;
     int86(16,&i,&o);
    }





 screen1()
 {
 int gd=DETECT,gm;
 initgraph(&gd,&gm,"..//bgi");
 setfillstyle(SOLID_FILL,RED);
 bar(0,0,640,480);
 setfillstyle(SOLID_FILL,WHITE);
 bar(15,15,625,465);
 setfillstyle(SOLID_FILL,RED);
 bar(30,30,610,450);
 settextstyle(1,0,8);
 setcolor(WHITE);
 outtextxy(190,35,"VIDEO");
 setfillstyle(SOLID_FILL,LIGHTGRAY);
 bar3d(180,140,385,130,20,20);
 outtextxy(160,150,"LIBRARY");
 bar3d(140,255,440,245,20,20);
 outtextxy(165,270,"SYSTEM");
 bar3d(145,375,440,365,20,20);
/* sleep(4);  */
getch();
 closegraph();
 restorecrtmode();
 }


 screen2()
 {
 int gd=DETECT,gm;
 initgraph(&gd,&gm,"..//bgi");
 setfillstyle(SOLID_FILL,RED);
 bar(0,0,640,480);
 setfillstyle(SOLID_FILL,WHITE);
 bar(15,15,625,465);
 setfillstyle(SOLID_FILL,RED);
 bar(30,30,610,450);
 setfillstyle(SOLID_FILL,LIGHTGRAY);
 bar3d(180,100,420,300,25,25); /*members bar*/
 settextstyle(1,1,10);
 setcolor(WHITE);
 outtextxy(10,55,"IIMS");
 setfillstyle(SOLID_FILL,LIGHTGRAY);
 bar3d(180,50,420,70,20,20);   /*project members bar*/
 bar3d(50,350,570,420,25,25);  /*project guide bar*/
 setcolor(BLUE);
 settextstyle(1,0,2);
 outtextxy(193,48,"PROJECT MEMBERS");


 outtextxy(193,130,"MANISH MISHRA");
 outtextxy(193,170,"VISHAL YADAV");
 outtextxy(193,210,"SHIV KUMAR RAI");
 outtextxy(193,250,"DINESH YADAV");



 outtextxy(235,351,"PROJECT GUIDE:");
 settextstyle(1,0,5);
 outtextxy(140,373,"MR. AMIT TANEJA");
/* sleep(4);  */
getch();
 closegraph();
 restorecrtmode();
 }

 box(int i,char *p)
 {
 setfillstyle(SOLID_FILL,WHITE);
 bar(179,108+55*i,409,138+55*i);
 setfillstyle(SOLID_FILL,LIGHTGRAY);
 bar(180,110+55*i,410,140+55*i);
 setcolor(BLUE);
// setfillstyle(SOLID_FILL,BLUE);
 settextstyle(1,0,2);
 outtextxy(184,110+55*i,p);
/* getch();
 setfillstyle(SOLID_FILL,WHITE);
 bar(180,60,390,90);
 setfillstyle(SOLID_FILL,RED);
 bar(179,59,389,89); */


/* bar3d(180,100,420,300,-25,25);*/ /*members bar*/
/* closegraph();
 restorecrtmode(); */
 }



selectbox(int i,char *p)
 {
 setfillstyle(SOLID_FILL,WHITE);
 bar(179,108+55*i,409,138+55*i);
 setfillstyle(SOLID_FILL,9);
 bar(180,110+55*i,410,140+55*i);
 setcolor(WHITE);
// setfillstyle(SOLID_FILL,BLUE);
 settextstyle(1,0,2);
 outtextxy(184,110+55*i,p);
/* getch();
 setfillstyle(SOLID_FILL,WHITE);
 bar(180,60,390,90);
 setfillstyle(SOLID_FILL,RED);
 bar(179,59,389,89); */


/* bar3d(180,100,420,300,-25,25);*/ /*members bar*/
/* closegraph();
 restorecrtmode(); */
 }



pressbutton(int i,char *p)
 {

 setfillstyle(SOLID_FILL,WHITE);
 bar(180,110+55*i,410,140+55*i);
 setfillstyle(SOLID_FILL,9);
 bar(179,108+55*i,409,138+55*i);
 setcolor(CYAN);
 settextstyle(1,0,2);
 outtextxy(184,110+55*i,p);
 delay(350);
 }
 title(char *title,int x)
 {
    setfillstyle(SOLID_FILL,9);
    bar(0,0,640,50);
    setcolor(BLACK);
    settextstyle(1,0,5);
    outtextxy(x,0,title);
 }

 status()
 {
    setfillstyle(SOLID_FILL,9);
    bar(0,450,640,480);
    setcolor(BLACK);
    settextstyle(1,0,3);
    outtextxy(30,450,"USE UP & DOWN ARROW KEYS TO SELECT AN OPTION");
 }


 void main()
    {
    screen1();
    screen2();
    main_menu();
    }

 
Share:

Total Pageviews

CONTACT US

Prof. Roshan P. Helonde
Mobile: +917276355704
WhatsApp: +917276355704
Email: roshanphelonde@rediffmail.com

Enter Project Title

Popular Projects

All Archive

Contact Form

Name

Email *

Message *