⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 deletebook.cpp

📁 图书馆管理系统 包括界面、书籍管理、会员管理等内容
💻 CPP
字号:
/*******Function to Delete Book******/
 # include"liba.h"

 void deletebook()
 {
   struct book B;
   int i,j,k;

   FILE *fb,*tt;
   window(1,1,80,2);
   textbackground(LIGHTGRAY);
   clrscr();
   gotoxy(30,1);
   textcolor(YELLOW);
   cprintf("Delete Book");
   window(1,2,80,25);
   textcolor(WHITE); 
   textbackground(BLUE);
   clrscr();
   fb=fopen("E:\\cpp\\book.dat","a+");
   if(( tt=fopen("temp2.dat","w"))==NULL)
    {
       printf("unable to open the file");
       exit(1);
    }
  textcolor(WHITE);
  gotoxy(5,1); cprintf("Enter Book id::");
  gotoxy(9,2); cprintf("/");
  gotoxy(13,2); cprintf("/");
  gotoxy(5,2); 
  scanf("%d",&i);
  gotoxy(10,2); 
  scanf("%d",&j);
  gotoxy(14,2);
  scanf("%d",&k);
  rewind(fb);
  while( fread(&B,sizeof(B),1,fb)==1 )
  {
   if(i==B.b.gno&&j==B.b.bno&&k==B.b.no){}
     else
      {fwrite(&B,sizeof(B),1,tt);}
  }

  fclose(tt); 
  fclose(fb);
  remove("book.dat");
  rename("temp2.dat","book.dat");

  printf("\n\t Book deleted...\npress any key to return...");
  getch();
 }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -