c语言图书管理系统上机实验报告!内容摘要:

binfo),sizeof(bbasic),1,fp) != 1) { printf(cannot save the data.)。 } } p2 next = NULL。 fclose(fp)。 return head。 } void modify() { struct linklist* p,*head。 char find[30]。 int i,ky,sum。 FILE *fp。 p= head = create()。 sum = readsum()。 clrscr()。 printf(Plese input the name of the book you want to modify:)。 scanf(%s,find)。 for (i = 0。 isum。 i++) { if(strcmp(find,p ) == 0) { gotoxy(2,2)。 cprintf(Please input the classfication of chinese library classification:)。 scanf(%s,amp。 (p ))。 getchar()。 gotoxy(2,4)。 cprintf(Please input the book39。 s number:)。 scanf(%s,amp。 (p ))。 getchar()。 gotoxy(2,6)。 cprintf(Please input the book39。 s name:)。 scanf(%s,amp。 (p ))。 getchar()。 gotoxy(2,8)。 cprintf(Please input the book39。 s writer:)。 scanf(%s,amp。 (p ))。 getchar()。 gotoxy(2,10)。 cprintf(Please input the the book39。 s press:)。 scanf(%s,amp。 (p ))。 getchar()。 gotoxy(2,12)。 cprintf(Please input the book39。 s edition:)。 scanf(%s,amp。 (p ))。 getchar()。 gotoxy(2,14)。 cprintf(Please input the book39。 s publish time:)。 scanf(%s,amp。 (p ))。 getchar()。 gotoxy(2,16)。 cprintf(Please input the price:)。 scanf(%f,amp。 (p ))。 getchar()。 gotoxy(2,18)。 cprintf(Please input the ISBN of the book:)。 scanf(%s,amp。 (p ))。 getchar()。 gotoxy(2,20)。 cprintf(Please input the count of books:)。 scanf(%d,amp。 (p ))。 getchar()。 gotoxy(2,22)。 cprintf(Please input the lend number of the book:)。 scanf(%d,amp。 (p ))。 getchar()。 printf(Press Y to continue or Press anykey to back to menu.)。 ky = key()。 if(ky == Key_Y) { p = head。 i = 1。 clrscr()。 printf(Plese input the name of the book you want to modify:)。 scanf(%s,find)。 } else { p = head。 if ((fp = fopen(e:\\,wb)) == NULL) { printf(cannot open )。 } for (i = 0。 i sum。 i++) { if(fwrite(amp。 (p binfo),sizeof(bbasic),1,fp) != 1) { clrscr()。 printf(cannot save the data.)。 } p = p next。 } fclose(fp)。 menu()。 } } p = p next。 } clrscr()。 printf(cannot find the book.)。 getch()。 } void delete() { struct linklist* p1,*p2,*head。 char find[30]。 int i,ky,sum,flag = 0。 FILE *fp。 p1 = p2 = head = create()。 sum = readsum()。 clrscr()。 printf(Plese input the name of the book you want to Delete:)。 scanf(%s,find)。 if(strcmp(find,head ) == 0) { head = head next。 sum。 flag = 1。 } else { for (i = 0。 i sum。 i++) { p1 = p1 next。 if(strcmp(find,p1 ) == 0) { p1 = p1 next。 p2 next = p1。 sum。 flag = 1。 break。 } else { p2 = p2 next。 } } } if (flag != 1) { printf(cannot find the book.)。 getch()。 menu()。 } p1 = head。 if ((fp = fopen(e:\\,wb)) == NULL) { printf(cannot open )。 } for (i = 0。 i sum。 i++) { if(fwrite(amp。 (p1 binfo),sizeof(bbasic),1,fp) != 1) { clrscr()。 printf(cannot save the data.)。 } p1 = p1 next。 } fclose(fp)。 if((fp = fopen(e:\\,wb)) == NULL) { printf(cannot open )。 } if(fwrite(amp。 sum,2,1,fp) != 1) { printf(fail to write the .)。 getch()。 exit(0)。 } fclose(fp)。 printf(succeed to delete the anykey to get back to the mainmenu.)。 getch()。 } void insert() { struct linklist* p1,*p2, *head, *temp。 char find[10]。 int i,ky,sum,flag = 0。 FILE *fp。 clrscr()。 sum = readsum()。 p1 = p2 = head = create()。 temp = (struct linklist*)malloc(LEN)。 printf(The number you want to insert behind:)。 scanf(%s,find)。 for(i = 0。 i sum。 i++) { p1 = p1next。 if(strcmp(find,p2 ) == 0) { p2 next = temp。 temp next =p1。 sum ++。 flag = 1。 break。 } else { p2 = p2next。 } } if (flag != 1) { printf(cannot find the book.)。 getch()。 menu()。 } clrscr()。 gotoxy(2,2)。 cprintf(Please input the classfication of chinese library classification:)。 scanf(%s,amp。 (temp ))。 getchar()。 gotoxy(2,4)。 cprintf(Please input the book39。 s number:)。 scanf(%s,amp。 (temp ))。 getchar()。 gotoxy(2,6)。 cprintf(Please input the book39。 s name:)。 scanf(%s,amp。 (temp ))。 getchar()。 gotoxy(2,8)。 cprintf(Please input the book39。 s writer:)。 scanf(%s,amp。 (temp ))。 getchar()。 gotoxy(2,10)。 cprintf(Please input the the book39。 s press:)。 scanf(%s,amp。 (temp ))。 getchar()。 gotoxy(2,12)。 cprintf(Please input the book39。 s edition:)。 scanf(%s,amp。 (temp ))。 getchar()。 gotoxy(2,14)。 cprintf(Please input the book39。 s publish time:)。 scanf(%s,amp。 (temp ))。 getchar()。 gotoxy(2,16)。 cprintf(Please input the price:)。 scanf(%f,amp。 (temp ))。 getchar()。 gotoxy(2,18)。 cprintf(Please input the ISBN of the book:)。 scanf(%s,amp。 (temp ))。 getchar()。 gotoxy(2,20)。 cprintf(Please input the count of books:)。 scanf(%d,amp。 (temp ))。 getchar()。 gotoxy(2,22)。 cprintf(Please input the lend number of the book:)。 scanf(%d,amp。 (temp ))。 getchar()。 gotoxy(10,25)。 cprintf(Press Y to continue or Press anykey to back to menu.)。 ky = key()。 if(ky == Key_Y) { insert()。 } else { p1 = head。 if ((fp = fopen(e:\\,wb)) == NULL) { printf(cannot open )。 } for (i = 0。 i sum。 i++) { if(fwrite(amp。 (p1 binfo),sizeof(bbasic),1,fp) != 1) { c。
阅读剩余 0%
本站所有文章资讯、展示的图片素材等内容均为注册用户上传(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考。 用户通过本站上传、发布的任何内容的知识产权归属用户或原始著作权人所有。如有侵犯您的版权,请联系我们反馈本站将在三个工作日内改正。