急求一个c语言编写的图书管理系统的源代码,谢谢

大家帮忙写一个图书管理程序啊,急用,我们的课程设计作业,大恩不言谢啊
开发一个图书管理程序:实现图书的填加,查询(按作者,出版社,库存量)查询,删除(按书号书名删除,删除前需进一部确认),修改(按书号书名)等操作。图书信息包括书号书名作者出版社出版年库存量。程序显示的菜单内容如下:
请选择下面一个项目:1创建 2添加 3查询 4删除 5输出6退出

第1个回答  2009-06-06
/* Note:Your choice is C IDE */
#include "stdio.h"
#include<graphics.h>
#include "conio.h"
#include<stdlib.h>
#include<string.h>

void main()
{void adm1(),adm2(),build(),huan(),borrow(),dele();
adm1();

}

void adm1()
{ FILE *fp,*p ;
char adp[20],password[20];
int i,n=0;
textbackground(2);
clrscr();
gotoxy(25,12);
fp=fopen("pass","r");
if(fp==NULL) { printf("no exit ");getch();exit(0);}
printf("input password:");
for(;;)
{

window(42,12,53,12);
textbackground(0);
clrscr();
gets(adp);
for(i=0;adp[i]!='\0';i++);
fgets(password,i+1,fp);
gotoxy(55,12);
if(strcmp(password,adp)==0) { window(55,12,70,12);clrscr();cprintf("YES");getch();adm2();getch();exit(0);}
else{ n++;
window(55,12,60,12);clrscr();gotoxy(55,12);cprintf("error");
for(i=0;i<30;i++) delay(8000);
if(n==2) { window(55,12,70,12);clrscr();gotoxy(55,12);cprintf("once again");for(i=0;i<=30;i++) delay(8000);}
if(n==3) { window(55,12,70,12);clrscr();gotoxy(55,12);cprintf("3 second out");for(i=0;i<=30;i++) { delay(8000);}
exit(0);
}
}
fclose(fp);clrscr();

}
}
void adm2()
{ char a;
window(1,1,80,25);
clrscr();
for(;;)
{ clrscr();
gotoxy(30,8);printf("built a new user (B)");
gotoxy(30,10);printf("return book (R)");
gotoxy(30,12);printf("borrow books (J)");
gotoxy(30,14);printf("delete user (D)");
a=getch();
if(a=='b') build();
if(a=='r') huan();
if(a=='j') borrow();
if(a=='d') dele();
else continue;

}

}

void build()
{ FILE *f,*p;
char id[20],name[20],sex[2],age[3],grad[50];
window(1,1,80,25);
clrscr();
printf("ID number:");
scanf("%s",id);
printf("name:");
scanf("%s",name);
printf("sex:");
scanf("%s",sex);
printf("grad:");
scanf("%s",grad);
p=fopen(id,"w+");
if(p==NULL) { printf("can't build that user");getch();adm2();}

fprintf(p,"%s ",name);
fprintf(p,"%s ",id);
fprintf(p,"%s ",sex);
fprintf(p,"%s ",grad);
printf("bulid success");
getch();
fclose(p);
}

void huan()
{
FILE *fp,*p,*f;
char id[20],a[5][50],name[20],c;
int i=0,m,k; clrscr();
printf("input ID number:");
scanf("%s",id);
p=fopen(id,"r");
if(p==NULL) { printf("error");getch();fclose(p);exit(0);}
fscanf(p,"%s",name);
fclose(p);
fp=fopen(name,"r");
do{ fscanf(fp,"%s",a[i++]); }while(!feof(fp));

for(k=0;k<i-1;k++) printf("\nbook %d: %s",k+1,a[k]);
fclose(fp);
f=fopen(name,"w+");
for(;;)
{
printf("\n\npress the book number that you want to return. \n\nPress 6 if you want to return all. \n\npress 7 to cancle.\n");
scanf("%d",&m);
if(m==7) { for(k=0;k<i-1;k++)
{
fprintf(f,"%s\n",a[k]);
}
fclose(f);
adm2();
}
if(m==6) remove(name);
if(m<6)
for(k=0;k<i-1;k++)
{ if(k!=m-1)
fprintf(f,"%s\n",a[k]);
}
printf("book %d has returned.",m);
printf("\ncontinue? (Y/N)");
c=getch();
if(c=='y') continue;
if(c=='n') { fclose(f);adm2(); }
}
}

void borrow()
{ FILE *f,*m,*p;
char id[20],book[5][50],name[20],c;
int i=0,n=0,k;
window(1,1,80,25);clrscr();
printf("please input the user's ID:");
scanf("%s",id);
m=fopen(id,"r");
if(m==NULL) { printf("user no exit"); getch();fclose(m);adm2();}
fscanf(m,"%s",name);
fclose(m);
p=fopen(name,"r");
if(p==NULL);
else
{ while(!feof(p))
{
fscanf(p,"%s",book[i]);
i++;
}
i--;
for(k=0;k<i;k++) printf("\nbook %d :%s",k+1,book[k]);
}
fclose(p);
f=fopen(name,"w");
printf("\nhow many book do you want to borrow?:");
do{printf("\ninput:");scanf("%d",&n); }while(i+n>=6);
for(k=i;k<i+n;k++)
{ printf("\nbook %d :",k+1);
scanf("%s",book[k]);
}
for(k=0;k<i+n;k++) fprintf(f,"%s\n",book[k]);
fputc('\0',f);
printf("success");
fclose(f);

}

void dele()
{ FILE *fp,*f;
char id[20],a[4][20],c,b[5][50];
int i=0,j=0,k;
window(1,1,80,25);clrscr();
printf("Input ID number:");
scanf("%s",id);
fp=fopen(id,"r");
if(fp==NULL) { printf("\nuser isn't exit");getch(); fclose(fp);adm2();}
else while(!feof(fp))
{ fscanf(fp,"%s",a[i++]);}
printf("\nname: %s",a[0]);
printf("\nID: %s",a[1]);
printf("\nsex: %s",a[2]);
printf("\ngrad: %s",a[3]);
f=fopen(a[0],"r");
if(f==NULL);
else {
while(!feof(f))
{ fscanf(f,"%s",b[j++]);}
for(k=0;k<j-1;k++) printf("\nbook %d: %s",k+1,b[k]);
}
printf("\nDo you want to delete? (Y/N): ");
c=getch();
fclose(fp);
fclose(f);
if(c=='y') { remove(id);remove(a[0]);printf("\nsuccess");getch();adm2();}
if(c=='n') adm2();
}本回答被提问者采纳

求C语言图书管理系统源代码
Lin[j]=Lin[j+1]; \/\/其后都往前移一位,覆盖掉当前信息 strcpy(Lin[j].CNum," "); \/\/删除图书证号 Retotal--; \/\/图书证数减1 } \/\/删除当前状态下没借书的图书证的信息,节省空间 if(flag==0) printf("无该证信息.\\n");}\/\/5、 查找:实现按三种查询条件之一查找:按书号查找、\/\/按书名查找、...

用C语言编写的"图书馆管理系统"的源代码,删减版
厉害

急求C语言图书管理系统代码
include#includeclassBook{\/\/书籍基类protected:charTitle[40];\/\/书名longCode;\/\/条码intType;\/\/0表示书,1表示杂志public:Book();Book(char*title,longcode);voidSetCode(longcode){Code=code;}voidSetTitle(char*tl){strcpy(Title,tl);}voidSetType(booltype){Type=type;}intGetType(){returnTyp...

c语言图书管理系统 用数组做
printf("\\t\\t\\t| * - * - * -图书管理系统 * - * - * |\\n"); printf("\\t\\t\\t| [1] 添加图书 |\\n"); printf("\\t\\t\\t* [2] 删减图书 *\\n"); printf("\\t\\t\\t| [3] 修改图书信息 |\\n"); printf("\\t\\t\\t* [4] 浏览图书信息 *\\n"); printf("\\t\\t\\t| [5] 退出...

急求一个c语言编写的图书管理系统的源代码,谢谢
\/* Note:Your choice is C IDE *\/ include "stdio.h"include<graphics.h> include "conio.h"include<stdlib.h> include<string.h> void main(){void adm1(),adm2(),build(),huan(),borrow(),dele();adm1();} void adm1(){ FILE *fp,*p ;char adp[20],password[20];int i,n=...

c语言图书管理系统代码,一定要能运行!!急!!详细要求在补充里~~,谢谢...
include<string.h> void main(){void adm1(),adm2(),build(),huan(),borrow(),dele();adm1();} void adm1(){ FILE *fp,*p ;char adp[20],password[20];int i,n=0;textbackground(2);clrscr();gotoxy(25,12);fp=fopen("pass","r");if(fp==NULL) { printf("no exit ")...

急求C语言编写的图书管理系统源代码,具体要求如下
综合运用C语言的基本知识和程序设计方法,开发一个简单的图书管理系统。具体功能要求如下:1. 图书管理:增加图书、修改图书、删除图书、统计图书;2. 借阅管理:查找图书、借阅图书、归还图书、借阅图书统计;3. 读者管理:申请读者卡、删除读者卡、修改读者卡;4. 馆员管理:添加管理员、修改管理员信息、删除管理员。根据...

用C语言设计一个图书管理系统(高手请进)
我写的,基本符合你最基本的要求,不知道合适不合适,自己没有电脑,这些代码还是在网吧写的...在TC2.0调试通过的:include <stdio.h> include <stdlib.h> include <string.h> define NUM 100 struct book { char booknum[8];char bookname[15];char author[12];char PubHouse[15];char Pub...

C语言课程设计图书馆管理系统加讲解
book())!=-1&&books[n].store<books[n].total){ printf("借阅者图书证列表:\\n");for(l=0;l<10;l++)if (books[n].usr[l]!=0)printf("[%d] - %d天\\n",books[n].usr[l],books[n].days[l]);printf("请输入借书证序号:");scanf("%d",&s);for(l=0;l<10;l++)...

编制程序,实现一个图书信息管理系统,功能包括录入、查询等。(c语言)
window(1,1,80,25);clrscr();for(;;){ clrscr();gotoxy(30,8);printf("built a new user (B)");gotoxy(30,10);printf("return book (R)");gotoxy(30,12);printf("borrow books (J)");gotoxy(30,14);printf("delete user (D)");a=getch();if(a=='b') build();if(a==...

相似回答