可按Ctrl+D收藏 蚂蚁资源网

蚂蚁资源网

c语言图书管理系统(c语言图书管理系统讲解)

  • 全部评论(3)
  • 互站网
  • #include#包含#includeTypedef struct {char编号[10]; //簿号char名称[20]; //标题Char作者[20]; //作者char发布[50]; //按CHAR时间[20]; //发布时间浮法价格;} mbook;类型{int count; //书名mbaceb书写[100]; //最大可以有100个书籍}超纤维;外血管库; void保存()//保存书籍信息。 {file * fp; if((fp = fopen(“library.doc”,“w”))== null)// .....................选择结构{printf( “\ n不能保存书籍信息\ n”);返回; fwrite(&library.count,sizeof(int),1,fp); fwrite(库.book.book,sizeof(library.book 0]),library.count,fp);} void putin()// ..................... ....................... {int y = 1;系统(系统)“CLS”);虽然(y)// .......................................... \ t pASE输入您的书号:“); scanf(”%s“,library.book [library.count] .number); printf(”\ t请输入标题:“); scanf(”%s“,库。书[library.count] .name); printf(“\ t请输入作者名称:”); scanf(“%s”,library.book [library.count] .author); Intf(“请输入发布商:“); scanf(”%s“,library.book [library.count] .publish; printf(”\ t请输入发布时间:“); scanf(”%s“,library.book [库.count]。时间); printf(“\ t请输入价格:”); fflush(stdin); scanf(“%f”,&library.book [library.count]。价格); library.count ++ ; Printf(“\ n不去继续输入(1.继续; 0,退出条目):”); fflush(stdin); scanf(“%d”,&y); if(y!= 1)//。 .........................................选择结构{Y = 0; BREak;}} save(); void look(){system(“cls”); Printf(“书籍编号\ T书名\ T作者姓名\ T出版社\ T日期\ T书籍价格\ n”); // ............... ..62 int i; for(i = 0; i
  • 2021-08-29 15:37:25
  • qian
  • 参考它!设计书籍信息管理系统,书籍信息包括:书号,标题,作者姓名,发布时间,价格等.1,系统在菜单中工作,密码登录。2.书籍信息的输入功能(添加数据)。 3.删除(删除数据)书籍信息。 4.浏览书籍信息的功能(查找数据)。 5.删除书籍信息(修改数据)。 6,]图书信息的计算分类。计算所有书籍的总价格和平均价格(AVER,单精度,输出十进制),将按所有数据顺序排序,按高于低电平。 #include #include #include #include #define stack_init_size 10 #define确定1 #define true 1 #define false 0 #define错误0 struct student / *定义学生类型,用于存储借用的书籍* / {int carnum; char lendbook [10];}学生[1000]; struct雇用/ *定义员工类型* / {int雇用; char elecommename [15]; int就业; CHAR雇员[2]; char雇员[10];长int雇用;雇佣[50];结构书/ *定义书籍类型* / {int booknum; Char BookName [10]; Char Bookcreat [10]; int turefalse; / *用于借用和返回模块以确定一本书是否从条件* /}书中借用[1000]; STRUCT CAR / *书卡的数据类型* / {int carnum; char studentname [10]; IntstudentClass;}车[100]; Huanbook()/ *返回一本书函数* / {file * fp,* fp2; / *定义两个文件指针,FP2用于设置临时文件,防止数据损坏* / int i,n; int carnum; Char Lendbook [10];printf(“请输入您的卡号\ n”); scanf(“%d”,&carnum); fp = fopen(“car.txt”,“r”); / *阅读卡号记录* / for(i = 0;欺诈(&car),1,fp)! = 0;对于循环判断卡号I ++)/ *存在* / {if(car [i] .carnum == carnum)/ *卡号存在,输入下一个循环* / {n = i; fclose(FP); Printf(“请输入您要支付的书籍的名称”); scanf(“%s”,lendbook); fp = fopen(“Record.txt”,“R”); for(i = 0;欺诈(和学生[i],sizeof(struct学生),1,fp)!= 0; i ++)/ *判断是否借用输入书* / {if(strcmp(学生[学生[ I] .Lendbook,Lendbook == 0)/ *借用书,输入下一个循环,否则显示错误* / {fclose(fp); fp = fopen(“record.txt”,“r”); fp2 = fopen(“bookl.txt”,“w”);对于(我= 0;欺诈(&学生[i],sizeof(struct学生),1,fp)! = 0; i ++){如果(strcmp(strcmp(strest [i] .lendbook,lendbook == 0){继续; / *删除借用的书记录/} fwrite(&stu)dent [i],sizeof(struct student),1, FP2); / *写出原始书籍* /} fclose(FP)的记录; fclose(FP2); fp = fopen(“replargr.txt”,“w”); fp2 = fopen(“bookl.txt”,“r”); for(i = 0;欺诈(和学生[i],sizeof(struct学生),1,fp2)!= 0; i ++){fwrite(结构),1,fp); / *写下借用的记录信息回来* /} fclose(FP); fclose(FP2); Fopen(“Bookl.txt”,“W”); / *清除临时文件记录* / fclose(FP2); fp = fopen(“book.txt”,“r”); fp2 = fopen(“bookl.txt”,“w”); for(i = 0;欺诈(&book [i],sizeof(struct book,1,fp)!= 0; i ++)/ *写入记录的record到临时文件以防止以前的记录* / {如果由于修改信息i == n){book [i] .turefalse = 1; fwrite(&book [i],sizeof(struct book),1,fp2); / *将本书的原始状态设置为无人借用* /继续; fwrite(结构书,1,fp2); fclose(fp); fclose(FP2); fp = fopen(“book.txt”,“w”); fp2 = fopen(“bookl.txt”,“r”); for(i = 0;欺诈(&book [i],sizeof(struct book,1,fp2)!= 0; i ++){fwrite(和书写[i],sizeof(struct book),1,fp) ; / *写一个临时文件* /} fclose(fp); fclose(fp2); fopen(“bookl.txt”,“w”); / * qing临时文件* / fclose(fp2); printf(“书完成,按任何键返回\ n“); getch();返回1;}} printf(”您没有借阅这本书,任何返回\ n的键); / *错误提示* / fclose( FP); getch();返回0; printf(“系统没有这样的卡片,以及管理员联系,按任意键返回\ n”); / *错误提示* / fclose fp); getch(); findbook(){file * fp; Char BookName [10]; int ture,我; fp = fopen(“book.txt”,“r”); printf(“请输入您想要查找标题\ n”); scanf(“%s”,bookname); for(i = 0;欺诈(&book [i],sizeof(struct book),1,fp)!= 0; i ++){if(strcmp(bookname,book [i] .bookname)== 0) {if(书[i] .turefalse == 1){printf(“本书详细信息是:%d%s%s现在没有人借用\ n按任何键返回\ n”,书[i] .booknum,书[i] .bookname,书[i] .bookcreat);} else {printf(“这本书借了\ n”); fclose(FP);返回0; fclose(FP);返回false;}} printf(没有你想要询问的“书\ ny); fclose(FP);返回false;} findbook1(){file * fp; Char Bookcreat [10]; int ture,我; fp = fopen(“book.txt”,“r”); printf(“请输入您想要查找的作者名称\ n”); scanf(“%s”,bookcreat); for(i = 0;欺诈(&book [i],sizeof(struct book),1,fp)!= 0; i ++){if(strcmp(书柜,书[i] .bookcreat)= = 0) {if(书[i] .turefalse == 1){printf(“本书详细信息是:%d%s%s.现在没有人借用\ n按任何键返回\ n”,书[i] .booknum ,书[i] .bookname,书[i] .bookcreat);} else {printf(“本书已经借来\ n”); fclose(FP);返回0; fclose(FP);返回false;}}} printf(“我要查询的书籍\ n”); fclose(FP); Returnaf false;} lendcount(){file * fp; int i,n = 0; fp = fopen(“Record.txt”,“R”); for(i = 0;欺诈(和学生[i],sizeof(struct学生),1,fp)! = 0; i ++){printf(“卡号:%d借书:%s \ n”,学生[i] .carnum,stuitent [i] .lendbook; n = n + 1;} fclose(fp); printf( “当前总共%d书\ n”,n); printf(“按任意键\ n”); getch();返回n; chabook(){char ch5; do {printf(“---- ----------欢迎来到图书馆查询系统!----------- \ n“); printf(”1: \ n“); printf( “2:<按书名查找> \ n”); printf(“0:<按作者查找> \ n”); printf(“请输入0--2,其他输入非法!\ n”); scanf(“%s”, &CH5);切换(CH5){案例'1':findbook()getch(); beaf; ub; case'2':findbook1(); getch(); betch();休息;案例'0':break;默认;默认;默认值:printf(“ nonwotes操作\ n“); getch();休息;}}} while(ch5!='0');返回false; leendbook(){file * fp,* fp2; int i,n; int carn嗯; printf(“请输入您的卡号\ n”); scanf(“%d”,&carnum); fp = fopen(“car.txt”,“r”); for(i = 0;欺诈(&car [i],sizeof(struct car),1,fp)!= 0; i ++){if(car [i] .carnum == carnum){n = i; fclose(FP); printf(“请输入您想要借用的书的名称”); Scanf(“%s”,student [n] .lendbook; fp = fopen(“book.txt”,“r”); for(i = 0;欺诈(和书写[i],sizeof(struct book),1 ,fp)!= 0; i ++){if(书[i] .bookname,学生[n] .lendbook)== 0){if(书[i] .turefalse == 0){printf(“抱歉这本书是借来的,请借用其他书籍\ n“); fclose(FP); getch();返回;}否则fclose(fp); fp = fopen(“Record.txt”,“A +”);学生[n] .carnum = carnum; FWRITE(&Student)[n],sizeof(struct学生),1,fp); fclose(FP); fp = fopen(“Book.txt“,”r“); fp2 = fopen(”bookl.txt“,”w“);对于(i = 0;欺诈(和书写[i],sizeof(struct book,1,fp)!= 0; i ++){if(strcmp(书[i] .bookname,student [n] .lendbook)== 0){book [i] .turefalse = 0; fwrite(和书籍[i],sizefof(struct书籍),1,FP2);继续; FWRITE(和书籍[i],sizeof(结构书),1,fp2)fclose(fp); fclose(fp2); fp = fopen(“book.txt”,“ w“); fp2 = fopen(”bookl.txt“,”r“);对于(i = 0; read)和书[i],sizeof(struct book),1,fp2)!= 0; I ++ ){fwrite(和书籍[i],sizeof(结构书),1,fp); fclose(fp); fclose(fp2)fopen(“bookl.txt”,“w”); fclose(fp2); printf (“借阅书后,按任意键返回\ n”); getch();返回;}} printf(“没有这样的书,任意键返回\ n”); fclose(fp); getch() ;返回;}} printf(“您的卡NuMBER不存在,请申请新卡,按任意键返回\ n“); fclose(fp); getch();} carcount(){file * fp; int i,n = 0; fp = fopen (“car.txt”,“r”);对于(i = 0;欺诈(&car),1,fp)!= 0; i ++){printf(“%d纸张<返回> \ n” ,i + 1,汽车[i] .carnum,汽车[i] .sudentname,汽车[i] .sudentclass; n = n + 1;} fclose(fp); printf(“当前总数为%d,prict%d \ n“,n); printf(”按任意键\ n“); getch();} delcar()}} delcar(){file * fp,* fp2; int i; int carnum; charn选择; fp = fopen (“car.txt”,“r”); fp2 = fopen(“bookl.txt”,“w”); printf(“请输入您想要删除的卡号\ n”); printf(“如果您输入的卡号存在,系统会自动删除此信息!如果没有存在,系统没有任何陈ges \ n“); scanf(”%d“,&carnum); for(i = 0;欺诈(&car [i],sizeof(struct car),1,fp)!= 0; i ++){如果(汽车[i] .carnum!= carnum){fwrite(&car [i],sizeof(struct car),1,fp2); fclose(fp); fclose(fp2); printf(“你真的吗?想要删除卡?删除后,本书的所有信息都无法恢复“y / n”\ n“); scanf(”%s“,和选择);如果(选择=='y'| |选择=='y'){fp = fopen(“car.txt”,“w”); fp2 = fopen(“bookl.txt”,“r”); for(i = 0;欺诈(&car [ i],sizeof(struct car),1,fp2)!= 0; i ++){fwrite(&car),1,fp); fclose(fp); fclose(fp2); fp2 = fopen(“bookl .txt“w”); fclose(fp2); printf(“按任意键返回\ n”); getch();返回;否则{printf(“按任意键返回\ n”); getch ();返回;}} addcar){file * fp; int我= 0; fp = fopen(“car.txt”,“a +”); printf(“请输入卡号\ n”); scanf(“%d”,&car [i]。carnum); printf(“请输入学生名称\ n”); scanf(“%s”,汽车[i] .studentname); printf(“请输入class \ n”); Scanf(“%d”,&car [i] .studentclass; fwrite(&car),1,fp); fclose(FP); printf(“输入,任何键返回\ n”); getch();}来源
  • 2021-08-29 15:34:12
  • hhcw0320
  • 用c语言写一个书店管理系统,包括图书信息 会员信息 销售信息三个系统,#include #include #include #include "graphics.h"#include "math.h"#define m 1 struct data { int year; int month; int day; };struct ReaderNode {char num[20]; struct data bro; struct data back; };struct BookNode {char title[15]; char writer[15]; int currentnum; int totalnum; char brief[30]; struct ReaderNode reader[20]; };struct TreeNode {int n; struct TreeNode *prt; int key[2*m]; struct BookNode *rec[2*m]; struct TreeNode *link[2*m+1]; };struct BookNode *InputNode();struct TreeNode *mbsearch(struct TreeNode *bth,int x,int *k,int *flag);struct TreeNode *mbinsert(struct TreeNode *bth);struct TreeNode *mbdel(struct TreeNode *bth);void OutputNode(struct TreeNode *bth);void borrow(struct TreeNode *bth);void payback(struct TreeNode *bth);char menu(void);struct TreeNode *mbsearch(struct TreeNode *bth,int x,int *k,int *flag){struct TreeNode *p,*q;p=bth; *flag=0; q=p; while( (p!=NULL) && (*flag==0) ) {*k=1;q=p;while( (*k q->n) && ( q->key[*k-1] < x) ) *k=*k+1; if( q->key[*k-1]==x) *flag=1; else if( ( *k==q->n ) && ( q->key[*k-1] x) ) {p=q->link[*k];p->prt=q;} else { p=q->link[*k-1]; p->prt=q;*k=*k-1;} }return(q);}
  • 2021-08-29 15:34:12
  • 商品推荐