Please help me with my problem.I have created a prog in C++ for use in a librar. But there are certain errors in it that i am not able to understand can u please correct this program for me.:rolleyes:
This is my "till now" Program.

#include<stdio.h>
#include<conio.h>
#include<io.h>
#include<fcntl.h>
#include<string.h>
#include<stdlib.h>
#include<alloc.h>
#include<dos.h>
int display();
long int getsize(char[]);
void editb();
void edits();
void bkst();
void stst();
void issue();
void viewret();
void retbook();
void bklt();
void stlt();
typedef struct date DATE;
DATE dt,is,rt;
int dtest;
typedef struct
{
char sno[6];
char name[20];
float fine;
char dept[3];
int token;
}student;
typedef struct
{
char bno[5];
char bname[50];
char aname[20];
DATE iss;
DATE ret;
char status[1];
char isto[6];
int cost;
char descpt[200];
}book;
int id,im,iy,rd,rm,ry;
void assign(book *b)
{
b->iss.da_year=iy;
b->iss.da_mon=im;
b->iss.da_day=id;
b->ret.da_day=rd;
b->ret.da_mon=rm;
b->ret.da_year=ry;
return;
}
void main()
{
int opt;
clrscr();
while(1)
{
if(dtest!=1)
{
getdate(&dt);
is=dt;
rt=dt;
iy=is.da_year;
im=is.da_mon;
id=is.da_day;
rt.da_day+=15;
if(rt.da_day>31)
{
rt.da_day-=31;
rt.da_mon+=1;
}
rd=rt.da_day;
rm=rt.da_mon;
ry=rt.da_year;
dtest=1;
}
opt=display();
switch(opt)
{
case 1:
editb();
continue;
case 2:
edits();
continue;
case 3:
stst();
continue;
case 4:
bkst();
continue;
case 9:
stlt();
continue;
case 8:
bklt();
continue;
case 0:
exit(0);
break;
case 5:
issue();
continue;
case 7:
retbook();
continue;
case 6:
viewret();
continue;
default:
continue;
}
}
}
long int getsize(char a[])
{
int file,size;
file = open(a,O_RDONLY);
size=filelength(file);
close(file);
if (size<0)
return 0;
else
return size;
}
void editb()
{
FILE *fp;
int opt,size,n,i,flag=0;
long int bsize;
char bn[6];
book *bk;
bsize=getsize("book.rrn");
size=(bsize)/sizeof(book);
bk=(book*)malloc((size)*sizeof(book));
printf("\nOPTIONS\n1.Add Book(s)\n2.Remove book\n \
Your choice:");
scanf("%d",&opt);
switch(opt)
{
case 1:
printf("How many books do you want to add? ");
scanf("%d",&n);
bk=(book*)malloc((n+size)*sizeof(book));
if(size==0)
fp=fopen("book.rrn","w+");
else
{
fp=fopen("book.rrn","r+");
fread(bk,sizeof(book),size,fp);
fcloseall();
}
for(i=size;i<=(n+size)-1;i++)
{
int temp,flag=0;
printf("No. of the book:");
scanf("%s",(bk+i)->bno);
for(temp=0;temp<size;temp++)
{
int cmp;
cmp=strcmp((bk+temp)->bno,(bk+i)->bno);
if((int)cmp==0)
{
flag=1;
break;
}
}
if(flag==1)
{
printf("\nBook is aldready present!\n");
i--;
continue;
}
printf("Name of the book:");
scanf("%s",(bk+i)->bname);
printf("Author Name:");
scanf("%s",(bk+i)->aname);
printf("Enter the cost of the book:");
scanf("%d",&(bk+i)->cost);
(bk+i)->status[0]='N';
printf("Enter a short description :");
scanf("%s",(bk+i)->descpt);
}
fp=fopen("book.rrn","w+");
fwrite(bk,sizeof(book),(n+size),fp);
printf("%d book(s) added succesfully!",n);
fcloseall();
getch();
clrscr();
return;
case 2:
printf("\nEnter the number of the book:");
scanf("%s",bn);
if(size==0)
{
printf("Book list does not exist!");
getch();
clrscr();
return;
}
fp=fopen("book.rrn","r+");
fread(bk,sizeof(book),size,fp);
fcloseall();
for(i=0;i<size;i++)
{
if(strncmp(bn,(bk+i)->bno,strlen(bn))==0)
{
flag=1;
break;
}
}
if(flag!=1)
{
printf("\nThe entered book id is invalid.");
getch();
clrscr();
return;
}
if((bk+i)->status[0]=='Y')
{
printf("\nCannot delete the book.The book has \
been issued!");
getch();
return;
}
for(;i<size-1;i++,n++)
{
*(bk+i)=*(bk+i+1);
}
size=size-1;
fp=fopen("book.rrn","w+");
fwrite(bk,sizeof(book),size,fp);
printf("Book removed succesfully!");
fcloseall();
getch();
clrscr();
return;
}
}
void edits()
{
FILE *fp;
int opt,size,n,i,flag=0;
long int bsize;
char bn[6];
student *st;
bsize=getsize("student.rrn");
size=(bsize)/sizeof(student);
st=(student*)malloc((size)*sizeof(student));
printf("\nOPTIONS\n1.Add Student(s)\n2.Remove \
student\nYour choice :");
scanf("%d",&opt);
switch(opt)
{
case 1:
printf("How many students do you want to add? ");
scanf("%d",&n);
st=(student*)malloc((n+size)*sizeof(student));
if(size==0)
fp=fopen("student.rrn","w+");
else
{
fp=fopen("student.rrn","r+");
fread(st,sizeof(student),size,fp);
fcloseall();
}
for(i=size;i<=(n+size)-1;i++)
{
int temp,flag=0;
printf("No. of the student:");
scanf("%s",(st+i)->sno);
for(temp=0;temp<size;temp++)
{
int cmp;
cmp=strncmp((st+i)->sno,(st+temp)->sno,6);
if((int)cmp==0)
{
flag=1;
break;
}
}
if(flag==1)
{
printf("\nStudent aldready present in the list!\n");
i--;
continue;
}
printf("Name of the student:");
scanf("%s",(st+i)->name);
printf("Department:");
scanf("%s",(st+i)->dept);
(st+i)->token=0;
(st+i)->fine=0;
}
fp=fopen("student.rrn","w+");
fwrite(st,sizeof(student),(n+size),fp);
printf("%d student(s) added succesfully!",n);
fcloseall();
getch();
clrscr();
return;
case 2:
printf("\nEnter the number of the student:");
scanf("%s",bn);
if(size==0)
{
printf("Student list does not exist!");
getch();
clrscr();
return;
}
fp=fopen("student.rrn","r+");
fread(st,sizeof(student),size,fp);
fcloseall();
for(i=0;i<size;i++)
{
if(strncmp(bn,(st+i)->sno,strlen(bn))==0)
{
flag=1;
break;
}
}

if(flag!=1)
{
printf("\nThe entered student id is invalid.");
getch();
clrscr();
return;
}
if((st+i)->token>0)
{
printf("\nCannot delete the student.The student has borrowed\
 books from library!");
getch();
return;
}
for(;i<size-1;i++,n++)
{
*(st+i)=*(st+i+1);
}
size=size-1;
fp=fopen("student.rrn","w+");
fwrite(st,sizeof(student),size,fp);
printf("Student removed succesfully!");
fcloseall();
getch();
clrscr();
return;
}
}
void stst()
{
int size,i,flag=0,bsize,size1,bsize1;
student *st;
book *bk;
FILE *fp;
char bn[6];
bsize=getsize("student.rrn");
size=(bsize)/sizeof(student);
bk=(book*)malloc((size)*sizeof(book));
printf("\nEnter the number of the student:");
scanf("%s",bn);
if(size==0)
{
printf("Student list does not exist!");
getch();
clrscr();
return;
}
fp=fopen("student.rrn","r+");
fread(st,sizeof(student),size,fp);
fcloseall();
for(i=0;i<size;i++)
{
int cmp;
cmp=strncmp((st+i)->sno,bn,6);
if((int)cmp==0)
{
flag=1;
break;
}
}
if(flag!=1)
{
printf("\nThe entered student id is invalid.");
getch();
clrscr();
return;
}
clrscr();
printf("\t\t\t\tSTUDENT DETAILS");
printf("\n\nStudent name:%s",(st+i)->name);
printf("\nDepartment:%s",(st+i)->dept);
printf("\nTokens Used: %d",(st+i)->token);
printf("\nFine:%.2f",(st+i)->fine);
if((st+i)->token==0)
{
getch();
clrscr();
return;
}
else if((st+i)->token!=0)
{
bsize1=getsize("book.rrn");
size1=(bsize1)/sizeof(book);
fp=fopen("book.rrn","r");
bk=(book*)malloc((size1)*sizeof(book));
fread(bk,sizeof(book),size1,fp);
fcloseall();
printf("\n\nBOOK(S) BORROWED FROM THE LIBRARY:\n");
for(i=0;i<size1;i++)
{
int chk;
chk=strncmp(bn,(bk+i)->isto,6);
if((int)chk==0&&(bk+i)->status[0]=='Y')
printf("\nBook.No:%s\tBook Name:%s\t\nIssue:%d-%d-%d\t \
Expected Return:%d-%d-%d\n",
(bk+i)->bno,(bk+i)->bname,(bk+i)->iss.da_day,\
(bk+i)->iss.da_mon,(bk+i)->iss.da_year,

(bk+i)->ret.da_day,(bk+i)->ret.da_mon,(bk+i)->ret.da_year);
}
printf("\nPress any key........");
getch();
clrscr();
return;
}
}
void bkst()
{
int size,i,flag=0,bsize;
student *st;
book *bk;
FILE *fp;
char bn[6];
bsize=getsize("book.rrn");
size=(bsize)/sizeof(book);
bk=(book*)malloc((size)*sizeof(book));
printf("\nEnter the number of the book:");
scanf("%s",bn);
if(size==0)
{
printf("Book list does not exist!");
getch();
clrscr();
return;
}
fp=fopen("book.rrn","r+");
fread(bk,sizeof(book),size,fp);
fcloseall();
for(i=0;i<size;i++)
{
int cmp;
cmp=strncmp((bk+i)->bno,bn,6);
if((int)cmp==0)
{
flag=1;
break;
}
}
if(flag!=1)
{
printf("\nThe entered book id is invalid.");
getch();
clrscr();
return;
}
clrscr();
printf("\n\n\t\t\t\tBOOK DETAILS");
printf("\n\nBook name:%s",(bk+i)->bname);
printf("\n\nAuthor Name:%s",(bk+i)->aname);
printf("\n\nCost:Rs %d.00",(bk+i)->cost);
printf("\n\nDesciption:%s",(bk+i)->descpt);
if((bk+i)->status[0]=='Y')
{
char temp[6];
strncpy(temp,(bk+i)->isto,6);
printf("\n\nStatus:Issued");
printf("\n\nIssued to: %.6s",temp);
printf("\n\nDate of issue:%d/%d/%d",(bk+i)->iss.da_day, \
(bk+i)->iss.da_mon,(bk+i)->iss.da_year);

printf("\n\nExpected date of return:%d/%d/%d", \
(bk+i)->ret.da_day,(bk+i)->ret.da_mon,(bk+i)->ret.da_year);

}
else
printf("\n\nStatus:Not Issued");
getch();
clrscr();
return;
}
int display()
{
int op;
char msg[26];
clrscr();
printf("\t\t\tLIBMAN-A Library Management Software\n");
printf("\n\nDate :%d/%d/%d\n",dt.da_day,dt.da_mon,dt.da_year);
printf("\n1.Edit book list");
printf("\n2.Edit Student list");
printf("\n3.Student status");
printf("\n4.Book status");
printf("\n5.Issue");
printf("\n6.View books");
printf("\n7.Return Books");
printf("\n8.View book list");
printf("\n9.View student list");
strcpy(msg,"0.Exit\nEnter your choice:");
printf("\n%s",msg);
scanf("%d",&op);
return op;
}
void issue()
{
char bno[6],sno[6];
int size,bsize,i,flag=0,size1,bsize1,j,flag1=0,flag2=0,flag3=0;
char msg[22];
FILE *fp;
book *bk;
student *st;
flag1=flag2=flag=flag3=0;
strcpy(msg,"Enter the book number:");
printf("\n%s",msg);
scanf("%s",bno);
bsize=getsize("book.rrn");
size=bsize/sizeof(book);
if(size==0)
{
printf("\nBooklist does not exist!");
getch();
return;
}
fp=fopen("book.rrn","r+");
bk=(book*)malloc(size*sizeof(book));
fread(bk,sizeof(book),size,fp);
fcloseall();
for(i=0;i<size;i++)
{
int temp;
temp=strncmp(bno,(bk+i)->bno,strlen(bno));
if((int)temp==0)
{
flag=1;
break;
}
}
if((bk+i)->status[0]=='N')
flag3=1;
if(flag==1 && flag3==1)
{
printf("Enter the student no:");
scanf("%s",sno);
bsize1=getsize("student.rrn");
size1=bsize1/sizeof(student);
fp=fopen("student.rrn","r+");
st=(student*)malloc(size1*sizeof(student));
fread(st,sizeof(student),size1,fp);
fcloseall();
for(j=0;j<size1;j++)
{
int temp;
temp=strncmp(sno,(st+j)->sno,strlen(sno));
if(temp==0)
{
flag1=1;
break;
}
}
if(flag1==1&&flag==1)
{
if((st+j)->token<5)
{
int price;
flag2=1;
fp=fopen("book.rrn","w+");
price=(bk+i)->cost;
strcpy((bk+i)->isto,sno);
(bk+i)->status[0]='Y';
(bk+i)->cost=price;
assign(bk+i);
fwrite(bk,sizeof(book),size,fp);
fcloseall();
fp=fopen("student.rrn","w+");
(st+j)->token+=1;
fwrite(st,sizeof(student),size1,fp);
fcloseall();
getch();
}
}
}
}

that is NOT a c++ program. Its a C program.

What are the errors? Post them.

And you really really need to develop a decent program coding style. Starting everything at the beginning of the line is just plain lazy and horrible. Nobody is going to read that stuff.

that is NOT a c++ program. Its a C program.

What are the errors? Post them.

And you really really need to develop a decent program coding style. Starting everything at the beginning of the line is just plain lazy and horrible. Nobody is going to read that stuff.

k i will do so.thank u.Well.....i am just a starter in c++.Thnx for ur suggestion .
I got my prob solved but it was a general c++ program.

it was a general c++ program.

No it isn't. A c++ program does not use stdio.h, string.h and many of the other header files that are in your program. Nor does a c++ program use printf(). And rarly do they use structures. In fact, your program does not contain even ONE line of c++ code.

you still have not posted any errors

And please use code tage, not php tags. For some reason I can't copy that into my clipboard.

It isn't even valid C, never mind C++.

I don't know which crusty old fossil compiler you're using (but I guess it's Turbo C), but you seriously need to upgrade to something in this century.

Here are a bunch of edits just to make the thing compile using a C compiler.
Watch out for all the !! comments.

#include<stdio.h>
/*!!#include<conio.h> non-standard header */
/*!!#include<io.h> non-standard header */
/*!!#include<fcntl.h> non-standard header */
#include<string.h>
#include<stdlib.h>
/*!!#include<alloc.h> non-standard header */
/*!!#include<dos.h> non-standard header */

/*!! stubs for non-portable functions */
/*!! write these using portable code */
void clrscr ( void ) {
}
int getch ( void ) {
  return 0;
}

/*!! why so few parameters, and why so many globals? */
int display();
long int getsize(char[]);
void editb();
void edits();
void bkst();
void stst();
void issue();
void viewret();
void retbook();
void bklt();
void stlt();

/*!! added */
/*!! which crusty old DOS header did you get this from? */
struct date {
  int da_year;
  int da_mon;
  int da_day;
};
/*!! end add */

typedef struct date DATE;

DATE dt,is,rt;
int dtest;

typedef struct
{
  char sno[6];
  char name[20];
  float fine;
  char dept[3];
  int token;
}student;

typedef struct
{
  char bno[5];
  char bname[50];
  char aname[20];
  DATE iss;
  DATE ret;
  char status[1];
  char isto[6];
  int cost;
  char descpt[200];
}book;

int id,im,iy,rd,rm,ry;

void assign(book *b)
{
  b->iss.da_year=iy;
  b->iss.da_mon=im;
  b->iss.da_day=id;
  b->ret.da_day=rd;
  b->ret.da_mon=rm;
  b->ret.da_year=ry;
  return;
}

/*!! bunch of functions which are NOT implemented */
/*!! we can't review code if you don't post it! */
void viewret() {
}
void retbook() {
}
void bklt() {
}
void stlt() {
}


/*!! main returns int - Always */
int main()
{
  int opt;
  clrscr();
  while(1)
  {
    if(dtest!=1)
    {
      getdate(&dt);
      is=dt;
      rt=dt;
      iy=is.da_year;
      im=is.da_mon;
      id=is.da_day;
      rt.da_day+=15;
      if(rt.da_day>31)
      {
        rt.da_day-=31;
        rt.da_mon+=1;
      }
      rd=rt.da_day;
      rm=rt.da_mon;
      ry=rt.da_year;
      dtest=1;
    }
    opt=display();
    switch(opt)
    {
      case 1:
        editb();
        continue;
      case 2:
        edits();
        continue;
      case 3:
        stst();
        continue;
      case 4:
        bkst();
        continue;
      case 9:
        stlt();
        continue;
      case 8:
        bklt();
        continue;
      case 0:
        exit(0);
        break;
      case 5:
        issue();
        continue;
      case 7:
        retbook();
        continue;
      case 6:
        viewret();
        continue;
      default:
        continue;
    }
  }
  return 0; /*!! main returns 0 for success */
}

long int getsize(char a[])
{
  int file,size;
#if 0
  /*!! remove non-standard code */
  /*!! use fopen / fseek / ftell to acheive this */
  file = open(a,O_RDONLY);
  size=filelength(file);
  close(file);
#endif
  if (size<0)
    return 0;
  else
    return size;
}

void editb()
{
  FILE *fp;
  int opt,size,n,i,flag=0;
  long int bsize;
  char bn[6];
  book *bk;
  bsize=getsize("book.rrn");
  size=(bsize)/sizeof(book);
  bk=(book*)malloc((size)*sizeof(book));
  printf("\nOPTIONS\n1.Add Book(s)\n2.Remove book\n \
      Your choice:");
  scanf("%d",&opt);
  switch(opt)
  {
    case 1:
      printf("How many books do you want to add? ");
      scanf("%d",&n);
      bk=(book*)malloc((n+size)*sizeof(book));
      if(size==0)
        fp=fopen("book.rrn","w+");
      else
      {
        fp=fopen("book.rrn","r+");
        fread(bk,sizeof(book),size,fp);
        fcloseall();
      }
      for(i=size;i<=(n+size)-1;i++)
      {
        int temp,flag=0;
        printf("No. of the book:");
        scanf("%s",(bk+i)->bno);
        for(temp=0;temp<size;temp++)
        {
          int cmp;
          cmp=strcmp((bk+temp)->bno,(bk+i)->bno);
          if((int)cmp==0)
          {
            flag=1;
            break;
          }
        }
        if(flag==1)
        {
          printf("\nBook is aldready present!\n");
          i--;
          continue;
        }
        printf("Name of the book:");
        scanf("%s",(bk+i)->bname);
        printf("Author Name:");
        scanf("%s",(bk+i)->aname);
        printf("Enter the cost of the book:");
        scanf("%d",&(bk+i)->cost);
        (bk+i)->status[0]='N';
        printf("Enter a short description :");
        scanf("%s",(bk+i)->descpt);
      }
      fp=fopen("book.rrn","w+");
      fwrite(bk,sizeof(book),(n+size),fp);
      printf("%d book(s) added succesfully!",n);
      fcloseall();
      getch();
      clrscr();
      return;
    case 2:
      printf("\nEnter the number of the book:");
      scanf("%s",bn);
      if(size==0)
      {
        printf("Book list does not exist!");
        getch();
        clrscr();
        return;
      }
      fp=fopen("book.rrn","r+");
      fread(bk,sizeof(book),size,fp);
      fcloseall();
      for(i=0;i<size;i++)
      {
        if(strncmp(bn,(bk+i)->bno,strlen(bn))==0)
        {
          flag=1;
          break;
        }
      }
      if(flag!=1)
      {
        printf("\nThe entered book id is invalid.");
        getch();
        clrscr();
        return;
      }
      if((bk+i)->status[0]=='Y')
      {
        printf("\nCannot delete the book.The book has \
            been issued!");
        getch();
        return;
      }
      for(;i<size-1;i++,n++)
      {
        *(bk+i)=*(bk+i+1);
      }
      size=size-1;
      fp=fopen("book.rrn","w+");
      fwrite(bk,sizeof(book),size,fp);
      printf("Book removed succesfully!");
      fcloseall();
      getch();
      clrscr();
      return;
  }
}

void edits()
{
  FILE *fp;
  int opt,size,n,i,flag=0;
  long int bsize;
  char bn[6];
  student *st;
  bsize=getsize("student.rrn");
  size=(bsize)/sizeof(student);
  st=(student*)malloc((size)*sizeof(student));
  printf("\nOPTIONS\n1.Add Student(s)\n2.Remove \
      student\nYour choice :");
  scanf("%d",&opt);
  switch(opt)
  {
    case 1:
      printf("How many students do you want to add? ");
      scanf("%d",&n);
      st=(student*)malloc((n+size)*sizeof(student));
      if(size==0)
        fp=fopen("student.rrn","w+");
      else
      {
        fp=fopen("student.rrn","r+");
        fread(st,sizeof(student),size,fp);
        fcloseall();
      }
      for(i=size;i<=(n+size)-1;i++)
      {
        int temp,flag=0;
        printf("No. of the student:");
        scanf("%s",(st+i)->sno);
        for(temp=0;temp<size;temp++)
        {
          int cmp;
          cmp=strncmp((st+i)->sno,(st+temp)->sno,6);
          if((int)cmp==0)
          {
            flag=1;
            break;
          }
        }
        if(flag==1)
        {
          printf("\nStudent aldready present in the list!\n");
          i--;
          continue;
        }
        printf("Name of the student:");
        scanf("%s",(st+i)->name);
        printf("Department:");
        scanf("%s",(st+i)->dept);
        (st+i)->token=0;
        (st+i)->fine=0;
      }
      fp=fopen("student.rrn","w+");
      fwrite(st,sizeof(student),(n+size),fp);
      printf("%d student(s) added succesfully!",n);
      fcloseall();
      getch();
      clrscr();
      return;
    case 2:
      printf("\nEnter the number of the student:");
      scanf("%s",bn);
      if(size==0)
      {
        printf("Student list does not exist!");
        getch();
        clrscr();
        return;
      }
      fp=fopen("student.rrn","r+");
      fread(st,sizeof(student),size,fp);
      fcloseall();
      for(i=0;i<size;i++)
      {
        if(strncmp(bn,(st+i)->sno,strlen(bn))==0)
        {
          flag=1;
          break;
        }
      }

      if(flag!=1)
      {
        printf("\nThe entered student id is invalid.");
        getch();
        clrscr();
        return;
      }
      if((st+i)->token>0)
      {
        printf("\nCannot delete the student.The student has borrowed\
            books from library!");
        getch();
        return;
      }
      for(;i<size-1;i++,n++)
      {
        *(st+i)=*(st+i+1);
      }
      size=size-1;
      fp=fopen("student.rrn","w+");
      fwrite(st,sizeof(student),size,fp);
      printf("Student removed succesfully!");
      fcloseall();
      getch();
      clrscr();
      return;
  }
}

void stst()
{
  int size,i,flag=0,bsize,size1,bsize1;
  student *st;
  book *bk;
  FILE *fp;
  char bn[6];
  bsize=getsize("student.rrn");
  size=(bsize)/sizeof(student);
  bk=(book*)malloc((size)*sizeof(book));
  printf("\nEnter the number of the student:");
  scanf("%s",bn);
  if(size==0)
  {
    printf("Student list does not exist!");
    getch();
    clrscr();
    return;
  }
  fp=fopen("student.rrn","r+");
  fread(st,sizeof(student),size,fp);
  fcloseall();
  for(i=0;i<size;i++)
  {
    int cmp;
    cmp=strncmp((st+i)->sno,bn,6);
    if((int)cmp==0)
    {
      flag=1;
      break;
    }
  }
  if(flag!=1)
  {
    printf("\nThe entered student id is invalid.");
    getch();
    clrscr();
    return;
  }
  clrscr();
  printf("\t\t\t\tSTUDENT DETAILS");
  printf("\n\nStudent name:%s",(st+i)->name);
  printf("\nDepartment:%s",(st+i)->dept);
  printf("\nTokens Used: %d",(st+i)->token);
  printf("\nFine:%.2f",(st+i)->fine);
  if((st+i)->token==0)
  {
    getch();
    clrscr();
    return;
  }
  else if((st+i)->token!=0)
  {
    bsize1=getsize("book.rrn");
    size1=(bsize1)/sizeof(book);
    fp=fopen("book.rrn","r");
    bk=(book*)malloc((size1)*sizeof(book));
    fread(bk,sizeof(book),size1,fp);
    fcloseall();
    printf("\n\nBOOK(S) BORROWED FROM THE LIBRARY:\n");
    for(i=0;i<size1;i++)
    {
      int chk;
      chk=strncmp(bn,(bk+i)->isto,6);
      if((int)chk==0&&(bk+i)->status[0]=='Y')
        printf("\nBook.No:%s\tBook Name:%s\t\nIssue:%d-%d-%d\t \
            Expected Return:%d-%d-%d\n",
      (bk+i)->bno,(bk+i)->bname,(bk+i)->iss.da_day,\
            (bk+i)->iss.da_mon,(bk+i)->iss.da_year,

            (bk+i)->ret.da_day,(bk+i)->ret.da_mon,(bk+i)->ret.da_year);
    }
    printf("\nPress any key........");
    getch();
    clrscr();
    return;
  }
}

void bkst()
{
  int size,i,flag=0,bsize;
  student *st;
  book *bk;
  FILE *fp;
  char bn[6];
  bsize=getsize("book.rrn");
  size=(bsize)/sizeof(book);
  bk=(book*)malloc((size)*sizeof(book));
  printf("\nEnter the number of the book:");
  scanf("%s",bn);
  if(size==0)
  {
    printf("Book list does not exist!");
    getch();
    clrscr();
    return;
  }
  fp=fopen("book.rrn","r+");
  fread(bk,sizeof(book),size,fp);
  fcloseall();
  for(i=0;i<size;i++)
  {
    int cmp;
    cmp=strncmp((bk+i)->bno,bn,6);
    if((int)cmp==0)
    {
      flag=1;
      break;
    }
  }
  if(flag!=1)
  {
    printf("\nThe entered book id is invalid.");
    getch();
    clrscr();
    return;
  }
  clrscr();
  printf("\n\n\t\t\t\tBOOK DETAILS");
  printf("\n\nBook name:%s",(bk+i)->bname);
  printf("\n\nAuthor Name:%s",(bk+i)->aname);
  printf("\n\nCost:Rs %d.00",(bk+i)->cost);
  printf("\n\nDesciption:%s",(bk+i)->descpt);
  if((bk+i)->status[0]=='Y')
  {
    char temp[6];
    strncpy(temp,(bk+i)->isto,6);
    printf("\n\nStatus:Issued");
    printf("\n\nIssued to: %.6s",temp);
    printf("\n\nDate of issue:%d/%d/%d",(bk+i)->iss.da_day, \
        (bk+i)->iss.da_mon,(bk+i)->iss.da_year);

    printf("\n\nExpected date of return:%d/%d/%d", \
        (bk+i)->ret.da_day,(bk+i)->ret.da_mon,(bk+i)->ret.da_year);

  }
  else
    printf("\n\nStatus:Not Issued");
  getch();
  clrscr();
  return;
}

int display()
{
  int op;
  char msg[26];
  clrscr();
  printf("\t\t\tLIBMAN-A Library Management Software\n");
  printf("\n\nDate :%d/%d/%d\n",dt.da_day,dt.da_mon,dt.da_year);
  printf("\n1.Edit book list");
  printf("\n2.Edit Student list");
  printf("\n3.Student status");
  printf("\n4.Book status");
  printf("\n5.Issue");
  printf("\n6.View books");
  printf("\n7.Return Books");
  printf("\n8.View book list");
  printf("\n9.View student list");
  strcpy(msg,"0.Exit\nEnter your choice:");
  printf("\n%s",msg);
  scanf("%d",&op);
  return op;
}

void issue()
{
  char bno[6],sno[6];
  int size,bsize,i,flag=0,size1,bsize1,j,flag1=0,flag2=0,flag3=0;
  char msg[22];
  FILE *fp;
  book *bk;
  student *st;
  flag1=flag2=flag=flag3=0;
  strcpy(msg,"Enter the book number:");
  printf("\n%s",msg);
  scanf("%s",bno);
  bsize=getsize("book.rrn");
  size=bsize/sizeof(book);
  if(size==0)
  {
    printf("\nBooklist does not exist!");
    getch();
    return;
  }
  fp=fopen("book.rrn","r+");
  bk=(book*)malloc(size*sizeof(book));
  fread(bk,sizeof(book),size,fp);
  fcloseall();
  for(i=0;i<size;i++)
  {
    int temp;
    temp=strncmp(bno,(bk+i)->bno,strlen(bno));
    if((int)temp==0)
    {
      flag=1;
      break;
    }
  }
  if((bk+i)->status[0]=='N')
    flag3=1;
  if(flag==1 && flag3==1)
  {
    printf("Enter the student no:");
    scanf("%s",sno);
    bsize1=getsize("student.rrn");
    size1=bsize1/sizeof(student);
    fp=fopen("student.rrn","r+");
    st=(student*)malloc(size1*sizeof(student));
    fread(st,sizeof(student),size1,fp);
    fcloseall();
    for(j=0;j<size1;j++)
    {
      int temp;
      temp=strncmp(sno,(st+j)->sno,strlen(sno));
      if(temp==0)
      {
        flag1=1;
        break;
      }
    }
    if(flag1==1&&flag==1)
    {
      if((st+j)->token<5)
      {
        int price;
        flag2=1;
        fp=fopen("book.rrn","w+");
        price=(bk+i)->cost;
        strcpy((bk+i)->isto,sno);
        (bk+i)->status[0]='Y';
        (bk+i)->cost=price;
        assign(bk+i);
        fwrite(bk,sizeof(book),size,fp);
        fcloseall();
        fp=fopen("student.rrn","w+");
        (st+j)->token+=1;
        fwrite(st,sizeof(student),size1,fp);
        fcloseall();
        getch();
      }
    }
  }
}

However, that's just the beginning.
When compiled with stricter options, new problems appear.

$ gcc -W -Wall -ansi -pedantic -O2 foo.c
foo.c: In function ‘main’:
foo.c:100: warning: implicit declaration of function ‘getdate’
foo.c: In function ‘getsize’:
foo.c:159: warning: unused variable ‘file’
foo.c:157: warning: unused parameter ‘a’
foo.c: In function ‘editb’:
foo.c:198: warning: implicit declaration of function ‘fcloseall’
foo.c: In function ‘bkst’:
foo.c:483: warning: unused variable ‘st’
foo.c: In function ‘getsize’:
foo.c:167: warning: ‘size’ is used uninitialized in this function
foo.c: In function ‘stst’:
foo.c:421: warning: ‘st’ is used uninitialized in this function

Those "used before initialised" problems need to be addressed.

Not to mention several buffer overflow problems.

strcpy(msg,"Enter the book number:");
  printf("\n%s",msg);

Why you didn't just call printf() with the fixed string is beyond me.

What is the point of this cast?

int cmp;
          cmp=strcmp((bk+temp)->bno,(bk+i)->bno);
          if((int)cmp==0)
printf("\nOPTIONS\n1.Add Student(s)\n2.Remove \
      student\nYour choice :");

The way to fold long strings is like this

printf("\nOPTIONS\n"
         "1.Add Student(s)\n"
         "2.Remove student\n"
         "Your choice :");

That's enough for now.
As has already been mentioned, this is all C.
So first off you need to decide which language you're actually trying to learn.

Thnx extremely .....My probs is solved

Hi Dragon.......Whats ur real name anyway?? Do u know I just created a BUS MANAGEMENT PROGRAM in C++.Can u please suggest me what should I do of it???

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.