資料庫課程設計c
⑴ 數據結構課程設計(基於C) 圖書管理系統
頭文件:
============
#ifndef _DATA_STRUCT_H_
#define _DATA_STRUCT_H_
/*圖書結構*/
struct Book
{
unsigned long BookID;/*圖書編號*/
char BookName[512];/*書名*/
char Writer[512];/*作者*/
int CurrentNumber;/*現存量*/
Book *pNext;/*下一個圖書信息*/
};
/*圖書索引結構*/
struct Index
{
unsigned long BookID;/*圖書編號*/
Index *pNext;/*下一個索引指針*/
};
/*借閱信息結構*/
struct Borrow
{
unsigned long BookID;/*借閱圖書編號*/
char BookName[512];/*書名*/
unsigned long StuID;/*圖書證號*/
char ReturnTime[512];/*歸還日期*/
Borrow *pNext;/*下一個借閱信息*/
};
#endif/*_DATA_STRUCT_H_*/
實現文件:
===============
// BookManage.cpp : 定義控制台應用程序的入口點。
//
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "DataStruct.h"
/*
數據結構課程設計(基於C) 圖書管理系統
懸賞分:100 - 離問題結束還有 14 天 23 小時
【問題描述】
圖書管理基本業務活動包括,對一本書的采編入庫、清楚庫存、借閱和歸還等等。試設計一個圖書管理系統,將上述業務活動藉助於計算機系統完成。
【基本要求】
(1) 每種書的登記至少包括書號春前好書名作者現存量總庫存量5項
(2)對書號建立索引表(線性表)以提高查找效率
(3) 系統要實現的操作及其功能定義如下:
1 采編入庫:新購入一種書,經分類和確定數好之後登記到圖書館賬目中去。如果這種書在賬戶中已有,則只將總庫存量增加。
2借閱:如果一本書的現存量悔友大於零,則借出一本,登出借閱者的圖書證扒鉛號和歸還日期
3歸還:注銷對借閱者的登記,改變該書的現存量
*/
/*獲取輸入字元串*/
void GetInput(char *pInOutStr,int StrLen,bool OnlyGetNumber = false);
/*顯示主菜單 並返回選擇*/
int ShowMainMenu();
/*圖書入庫操作,傳入參數為圖書列表頭指針的指針和索引信息的頭指針的指針,因為在此函數內部可能會改變頭指針的值*/
void PutBookInLib(Book **pHead,Index **pIndex);
/*查詢圖書館庫存,查詢不改變數據,故傳入指針即可*/
void QueryBookLib(Book *pHead);
/*借閱圖書*/
void BorrowBook(Borrow **pBorrow,Book *pHead);
/*查詢借閱*/
void QueryBorrow(Borrow *pBorrow);
/*歸還圖書*/
void ReturnBook(Borrow **pBorrow,Book *pHead);
/*釋放圖書鏈表及索引鏈表及借閱信息鏈表*/
void DeleteBookList(Book **pHead);
void DeleteIndexList(Index **pIndex);
void DeleteBorrowList(Borrow **pBorrow);
int main()
{
/*圖書列表頭指針*/
Book *pBookHead = NULL;
/*圖書索引頭指針*/
Index *pIndexHead = NULL;
/*借閱信息頭指針*/
Borrow *pBorrowHead = NULL;
/*用來保存當前用戶的輸入*/
int ChoosedNum = -1;
while ( true )
{
ChoosedNum = ShowMainMenu();
switch(ChoosedNum)
{
case 0 :/*退出*/
{
return 0;
break;
}
case 1:/*圖書入庫*/
{
PutBookInLib(&pBookHead,&pIndexHead);
break;
}
case 2:/*查詢庫存*/
{
QueryBookLib(pBookHead);
printf("按回車鍵繼續...");
fflush(stdin);
getchar();
system("cls");
break;
}
case 3:/*借閱圖書*/
{
QueryBookLib(pBookHead);
BorrowBook(&pBorrowHead,pBookHead);
break;
}
case 4:/*查詢借閱*/
{
QueryBorrow(pBorrowHead);
printf("按回車鍵繼續...");
fflush(stdin);
getchar();
system("cls");
break;
}
case 5:/*歸還圖書*/
{
QueryBorrow(pBorrowHead);
ReturnBook(&pBorrowHead,pBookHead);
break;
}
}
}
DeleteBookList(&pBookHead);
DeleteIndexList(&pIndexHead);
DeleteBorrowList(&pBorrowHead);
fflush(stdin);
getchar();
return 0;
}
/*獲取輸入字元串*/
void GetInput(char *pInOutStr,int StrLen,bool OnlyGetNumber)
{
memset(pInOutStr,0x0,StrLen);
fflush(stdin);
int Count = 0;
while ( true )
{
char TmpC = 0;
fread(&TmpC,1,1,stdin);
if ( 10 == TmpC )
{
break;
}
if ( OnlyGetNumber && TmpC >= '0' && TmpC <= '9' )
{
pInOutStr[Count] = TmpC;
Count++;
}
else
{
pInOutStr[Count] = TmpC;
Count++;
}
}
}
/*顯示主菜單 並返回選擇*/
int ShowMainMenu()
{
char InPutStr[1024];
NO_INPUT:
printf("\n\n\n");
printf("******************************************************************\n");
printf("* 圖書管理系統 *\n");
printf("******************************************************************\n");
printf("\n");
printf("請選擇:\n");
printf("\t1.圖書入庫\n");
printf("\t2.查詢庫存\n");
printf("\t3.借閱圖書\n");
printf("\t4.查詢借閱\n");
printf("\t5.歸還圖書\n");
printf("\t0.退出\n");
printf("\n");
printf("\t輸入 : ");
GetInput(InPutStr,1024,true);
if ( strlen(InPutStr) < 1 )
{
system("cls");
goto NO_INPUT;
}
return atoi(InPutStr);
}
/*圖書入庫操作*/
void PutBookInLib(Book **pHead,Index **pIndex)
{
Book *pWork = *pHead;
unsigned long BookID = 1;
char InPutStr[1024];
/*先計算處當前入庫圖書的ID號*/
if ( NULL == pWork )
{
BookID = 1;
}
else
{
while ( pWork->pNext != NULL )
{
pWork = pWork->pNext;
}
BookID = pWork->BookID + 1;
}
Book *pTmpNewBook = (Book *)(malloc(sizeof(Book)));
memset(pTmpNewBook,0x0,sizeof(Book));
Index *pTmpIndex = (Index *)(malloc(sizeof(Index)));
memset(pTmpIndex,0x0,sizeof(Index));
pTmpNewBook->BookID = BookID;
pTmpIndex->BookID = BookID;
system("cls");
printf("輸入圖書名稱 : ");
GetInput(InPutStr,1024);
strcpy(pTmpNewBook->BookName,InPutStr);
system("cls");
printf("<<%s>>\n",pTmpNewBook->BookName);
printf("圖書作者 : ");
GetInput(InPutStr,1024);
strcpy(pTmpNewBook->Writer,InPutStr);
system("cls");
printf("<<%s>>\n",pTmpNewBook->BookName);
printf("作者:%s\n",pTmpNewBook->Writer);
printf("入庫數量 : ");
GetInput(InPutStr,1024,true);
pTmpNewBook->CurrentNumber = atoi(InPutStr);
if ( pTmpNewBook->CurrentNumber < 1 )
{
system("cls");
printf("入庫數量錯誤!(按回車鍵繼續...)");
fflush(stdin);
getchar();
system("cls");
return;
}
if ( NULL == *pHead )
{
*pHead = pTmpNewBook;
*pIndex = pTmpIndex;
}
else
{
Book *pWork = *pHead;
while ( pWork != NULL )
{
if ( strcmp(pWork->BookName,pTmpNewBook->BookName) == 0 && strcmp(pWork->Writer,pTmpNewBook->Writer) == 0 )
{
pWork->CurrentNumber += pTmpNewBook->CurrentNumber;
return;
}
pWork = pWork->pNext;
}
pWork = *pHead;
while ( pWork->pNext != NULL )
{
pWork = pWork->pNext;
}
pWork->pNext = pTmpNewBook;
Index *pWork2 = *pIndex;
while ( pWork2->pNext != NULL )
{
pWork2 = pWork2->pNext;
}
pWork2->pNext = pTmpIndex;
}
system("cls");
printf("圖書:<<%s>>\n作者:%s\n入庫數:%d\n\n入庫操作成功!(按回車鍵繼續...)",pTmpNewBook->BookName,pTmpNewBook->Writer,pTmpNewBook->CurrentNumber);
fflush(stdin);
getchar();
system("cls");
}
/*釋放圖書鏈表及索引鏈表*/
void DeleteBookList(Book **pHead)
{
Book *pWork = *pHead;
Book *pNext = pWork;
while ( NULL != pWork )
{
pNext = pWork->pNext;
free(pWork);
pWork = pNext;
}
}
void DeleteIndexList(Index **pIndex)
{
Index *pWork = *pIndex;
Index *pNext = pWork;
while ( NULL != pWork )
{
pNext = pWork->pNext;
free(pWork);
pWork = pNext;
}
}
void DeleteBorrowList(Borrow **pBorrow)
{
Borrow *pWork = *pBorrow;
Borrow *pNext = pWork;
while ( NULL != pWork )
{
pNext = pWork->pNext;
free(pWork);
pWork = pNext;
}
}
/*查詢圖書館庫存,查詢不改變數據,故傳入指針即可*/
void QueryBookLib(Book *pHead)
{
Book *pWork = pHead;
int TotalCount = 0;
while ( NULL != pWork )
{
TotalCount++;
pWork = pWork->pNext;
}
system("cls");
printf("當前庫存共%d種圖書,列表如下:\n=====================================================\n",TotalCount);
pWork = pHead;
while ( NULL != pWork )
{
printf("編號:[%d] 書名:<<%s>> 作者:%s 當前庫存:%d\n",pWork->BookID,pWork->BookName,pWork->Writer,pWork->CurrentNumber);
pWork = pWork->pNext;
}
printf("=====================================================\n",TotalCount);
}
/*借閱圖書*/
void BorrowBook(Borrow **pBorrow,Book *pHead)
{
char InPutStr[1024];
bool HadTheBook = false;
Borrow *pTmpBorrow = (Borrow *)(malloc(sizeof(Borrow)));
memset(pTmpBorrow,0x0,sizeof(Borrow));
printf("請輸入你想借書的編號 : ");
GetInput(InPutStr,1024,true);
pTmpBorrow->BookID = atoi(InPutStr);
Book *pWorkBook = pHead;
while ( pWorkBook != NULL )
{
if ( pWorkBook->BookID == pTmpBorrow->BookID )
{
HadTheBook = true;
break;
}
pWorkBook = pWorkBook->pNext;
}
if ( HadTheBook )
{
if ( pWorkBook->CurrentNumber < 1 )
{
system("cls");
printf("圖書<<%s>>當前無庫存,無法借閱!\n(按回車鍵繼續...)",pWorkBook->BookName);
fflush(stdin);
getchar();
system("cls");
free(pTmpBorrow);
return;
}
}
else
{
system("cls");
printf("圖書編號%d不存在!\n(按回車鍵繼續...)",pTmpBorrow->BookID);
fflush(stdin);
getchar();
system("cls");
free(pTmpBorrow);
return;
}
strcpy(pTmpBorrow->BookName,pWorkBook->BookName);
printf("請輸入借書證號 : ");
GetInput(InPutStr,1024,true);
pTmpBorrow->StuID = atoi(InPutStr);
if ( 0 == pTmpBorrow->StuID )
{
system("cls");
printf("借書證號不存在(借書證號輸入整數)!\n(按回車鍵繼續...)");
fflush(stdin);
getchar();
system("cls");
free(pTmpBorrow);
return;
}
time_t ltime;
struct tm *today;
time(<ime);
ltime += 60 * 60 * 24 * 30;
today = localtime(<ime);
sprintf(pTmpBorrow->ReturnTime,"%d年%d月%d日", today->tm_year+1900,
today->tm_mon+1,
today->tm_mday);
if ( *pBorrow == NULL )
{
*pBorrow = pTmpBorrow;
}
else
{
Borrow *pWork = *pBorrow;
while ( NULL != pWork->pNext )
{
pWork = pWork->pNext;
}
pWork->pNext = pTmpBorrow;
}
pWorkBook->CurrentNumber--;
system("cls");
printf("借書證號:%d\n借閱圖書:<<%s>>\n\n操作成功!(按回車鍵繼續...)",pTmpBorrow->StuID,pTmpBorrow->BookName);
fflush(stdin);
getchar();
system("cls");
}
/*查詢借閱*/
void QueryBorrow(Borrow *pBorrow)
{
Borrow *pWork = pBorrow;
int TotalCount = 0;
while ( NULL != pWork )
{
TotalCount++;
pWork = pWork->pNext;
}
system("cls");
printf("當前借閱信息共%d條,列表如下:\n=====================================================\n",TotalCount);
pWork = pBorrow;
while ( NULL != pWork )
{
printf("借數證號:[%d] 借書名:<<%s>> 圖書編號:%d 歸還日期:%s\n",pWork->StuID,pWork->BookName,pWork->BookID,pWork->ReturnTime);
pWork = pWork->pNext;
}
printf("=====================================================\n",TotalCount);
}
/*歸還圖書*/
void ReturnBook(Borrow **pBorrow,Book *pHead)
{
char InPutStr[1024];
Borrow TmpBorrow;
bool HasFindBorrwo = false;
memset(&TmpBorrow,0x0,sizeof(TmpBorrow));
printf("請輸入借書證號 : ");
GetInput(InPutStr,1024,true);
TmpBorrow.StuID = atoi(InPutStr);
printf("請輸入所還圖書編號 : ");
GetInput(InPutStr,1024,true);
TmpBorrow.BookID = atoi(InPutStr);
Borrow *pWorkBorrow = *pBorrow;
Borrow *pDeletePre = NULL;
while ( NULL != pWorkBorrow )
{
if ( pWorkBorrow->BookID == TmpBorrow.BookID && pWorkBorrow->StuID == TmpBorrow.StuID )
{
HasFindBorrwo = true;
break;
}
pDeletePre = pWorkBorrow;
pWorkBorrow = pWorkBorrow->pNext;
}
if ( ! HasFindBorrwo )
{
system("cls");
printf("你輸入的借書信息不存在!\n(按回車鍵繼續...)");
fflush(stdin);
getchar();
system("cls");
return;
}
if ( NULL == pDeletePre )
{
*pBorrow = pWorkBorrow->pNext;
}
else
{
pDeletePre->pNext = pWorkBorrow->pNext;
}
Book *pWorkBook = pHead;
while ( NULL != pWorkBook )
{
if ( pWorkBook->BookID == pWorkBorrow->BookID )
{
pWorkBook->CurrentNumber ++;
}
pWorkBook = pWorkBook->pNext;
}
system("cls");
printf("借書證號:%d\n歸還圖書:<<%s>>\n\n操作成功!(按回車鍵繼續...)",pWorkBorrow->StuID,pWorkBorrow->BookName);
fflush(stdin);
getchar();
system("cls");
free(pWorkBorrow);
}
⑵ 圖書館管理系統 數據結構課程設計 c語言
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
struct books_list
{
char author[20]; /*作者名*/
char bookname[20]; /*書名*/
char publisher[20]; /*出版單位*/
char pbtime[15]; /*出版時間*/
char loginnum[10]; /*登陸號*/
float price; /*價格*/
char classfy[10]; /*分類號*/
struct books_list * next; /*鏈表的指針域*/
};
struct books_list * Create_Books_Doc(); /*新建鏈表*/
void InsertDoc(struct books_list * head); /*插入*/
void DeleteDoc(struct books_list * head , int num);/*刪除*/
void Print_Book_Doc(struct books_list * head);/*瀏覽*/
void search_book(struct books_list * head); /*查詢*/
void info_change(struct books_list * head);/*修改*/
void save(struct books_list * head);/*保存數據至文件*/
/*新建鏈表頭節點*/
struct books_list * Create_Books_Doc()
{
struct books_list * head;
head=(struct books_list *)malloc(sizeof(struct books_list)); /*分配頭節點空間*/
head->next=NULL; /*頭節點指針域初始化,定為空*/
return head;
}
/*保存數據至文件*/
void save(struct books_list * head)
{
struct books_list *p;
FILE *fp;
p=head;
fp=fopen("data.txt","w+"); /*以寫方式新建並打開 data.txt文件*/
fprintf(fp,"┏━━━┳━━━━━┳━━━━━┳━━━━━┳━━━━━━┳━━━┳━━━━┓\n"); /*向文件輸出表格*/
fprintf(fp,"┃登錄號┃ 書 名 ┃ 作 者┃ 出版單位 ┃ 出版時間 ┃分類號┃ 價格 ┃\n");
fprintf(fp,"┣━━━╋━━━━━╋━━━━━╋━━━━━╋━━━━━━╋━━━╋━━━━┫\n");
/*指針從頭節點開始移動,遍歷至尾結點,依次輸出圖書信息*/
while(p->next!= NULL)
{
p=p->next;
fprintf(fp,"┃%-6.6s┃%-10.10s┃%-10.10s┃%-10.10s┃%-12.12s┃%-6.6s┃%.2f ┃\n",p->loginnum,p->bookname,p->author,p->publisher,p->pbtime,p->classfy,p->price);
}
fprintf(fp,"┗━━━┻━━━━━┻━━━━━┻━━━━━┻━━━━━━┻━━━┻━━━━┛\n");
fclose(fp);
printf(" 已將圖書數據保存到 data.txt 文件\n");
}
/*插入*/
void InsertDoc(struct books_list *head)
{
/*定義結構體指針變數 s指向開辟的新結點首地址 p為中間變數*/
struct books_list *s, *p;
char flag='Y'; /*定義flag,方便用戶選擇重復輸入*/
p=head;
/*遍歷到尾結點,p指向尾結點*/
while(p->next!= NULL)
{
p=p->next;
}
/*開辟新空間,存入數據,添加進鏈表*/
while(flag=='Y'||flag=='y')
{
s=(struct books_list *)malloc(sizeof(struct books_list));
printf("\n 請輸入圖書登陸號:");
fflush(stdin);
scanf("%s",s->loginnum);
printf("\n 請輸入圖書書名:");
fflush(stdin);
scanf("%s",s->bookname);
printf("\n 請輸入圖書作者名:");
fflush(stdin);
scanf("%s",s->author);
printf("\n 請輸入圖書出版社:");
fflush(stdin);
scanf("%s",s->publisher);
printf("\n 請輸入圖書出版時間:");
fflush(stdin);
scanf("%s",s->pbtime);
printf("\n 請輸入圖書分類號:");
fflush(stdin);
scanf("%s",s->classfy);
printf("\n 請輸入圖書價格:");
fflush(stdin);
scanf("%f",&s->price);
printf("\n");
p->next=s; /*將新增加的節點添加進鏈表*/
p=s; /*p指向尾節點,向後移*/
s->next=NULL;
printf(" ━━━━ 添加成功!━━━━");
printf("\n 繼續添加?(Y/N):");
fflush(stdin);
scanf("%c",&flag);
printf("\n");
if(flag=='N'||flag=='n')
{break;}
else if(flag=='Y'||flag=='y')
{continue;}
}
save(head); /*保存數據至文件*/
return;
}
/*查詢操作*/
void search_book(struct books_list *head)
{
struct books_list * p;
char temp[20];
p=head;
if(head==NULL || head->next==NULL) /*判斷資料庫是否為空*/
{
printf(" ━━━━ 圖書庫為空!━━━━\n");
}
else
{
printf("請輸入您要查找的書名: ");
fflush(stdin);
scanf("%s",temp);
/*指針從頭節點開始移動,遍歷至尾結點,查找書目信息*/
while(p->next!= NULL)
{
p=p->next;
if(strcmp(p->bookname,temp)==0)
{
printf("\n圖書已找到!\n");
printf("\n");
printf("登錄號: %s\t\n",p->loginnum);
printf("書名: %s\t\n",p->bookname);
printf("作者名: %s\t\n",p->author);
printf("出版單位: %s\t\n",p->publisher);
printf("出版時間: %s\t\n",p->pbtime);
printf("分類號: %s\t\n",p->classfy);
printf("價格: %.2f\t\n",p->price);
}
if(p->next==NULL)
{
printf("\n查詢完畢!\n");
}
}
}
return;
}
/*瀏覽操作*/
void Print_Book_Doc(struct books_list * head)
{
struct books_list * p;
if(head==NULL || head->next==NULL) /*判斷資料庫是否為空*/
{
printf("\n ━━━━ 沒有圖書記錄! ━━━━\n\n");
return;
}
p=head;
printf("┏━━━┳━━━━━┳━━━━━┳━━━━━┳━━━━━━┳━━━┳━━━━┓\n");
printf("┃登錄號┃ 書 名 ┃ 作 者┃ 出版單位 ┃ 出版時間 ┃分類號┃ 價格 ┃\n");
printf("┣━━━╋━━━━━╋━━━━━╋━━━━━╋━━━━━━╋━━━╋━━━━┫\n");
/*指針從頭節點開始移動,遍歷至尾結點,依次輸出圖書信息*/
while(p->next!= NULL)
{
p=p->next;
printf("┃%-6.6s┃%-10.10s┃%-10.10s┃%-10.10s┃%-12.12s┃%-6.6s┃%.2f ┃\n",p->loginnum,p->bookname,p->author,p->publisher,p->pbtime,p->classfy,p->price); /*循環輸出表格*/
}
printf("┗━━━┻━━━━━┻━━━━━┻━━━━━┻━━━━━━┻━━━┻━━━━┛\n");
printf("\n");
}
/*修改操作*/
void info_change(struct books_list * head)
{
struct books_list * p;
int panan=0; /*此變數用於判斷是否找到書目*/
char temp[20];
p=head;
printf("請輸入要修改的書名:");
scanf("%s",temp);
while(p->next!= NULL)
{
p=p->next;
if(strcmp(p->bookname,temp)==0)
{
printf("\n 請輸入圖書登陸卡號:");
fflush(stdin);
scanf("%s",p->loginnum);
printf("\n 請輸入圖書書名:");
fflush(stdin);
scanf("%s",p->bookname);
printf("\n 請輸入圖書作者名:");
fflush(stdin);
scanf("%s",p->author);
printf("\n 請輸入圖書出版社:");
fflush(stdin);
scanf("%s",p->publisher);
printf("\n 請輸入圖書出版時間:");
fflush(stdin);
scanf("%s",p->pbtime);
printf("\n 請輸入圖書分類號:");
fflush(stdin);
scanf("%s",p->classfy);
printf("\n 請輸入圖書價格:");
fflush(stdin);
scanf("%f",&p->price);
printf("\n");
panan=1;
}
}
if(panan==0)
{
printf("\n ━━━━ 沒有圖書記錄! ━━━━\n\n");
}
return;
}
/*刪除操作*/
void DeleteDoc(struct books_list * head)
{
struct books_list *s,*p; /*s為中間變數,p為遍歷時使用的指針*/
char temp[20];
int panan; /*此變數用於判斷是否找到了書目*/
panan=0;
p=s=head;
printf(" [請輸入您要刪除的書名]:");
scanf("%s",temp);
/*遍歷到尾結點*/
while(p!= NULL)
{
if(strcmp(p->bookname,temp)==0)
{
panan++;
break;
}
p=p->next;
}
if(panan==1)
{
for(;s->next!=p;) /*找到所需刪除卡號結點的上一個結點*/
{
s=s->next;
}
s->next=p->next; /*將後一節點地址賦值給前一節點的指針域*/
free(p);
printf("\n ━━━━ 刪除成功! ━━━━\n");
}
else /*未找到相應書目*/
{
printf(" 您輸入的書目不存在,請確認後輸入!\n");
}
return;
}
int main(void)
{
struct books_list * head;
char choice;
head=NULL;
for(;;) /*實現反復輸入選擇*/
{
printf(" ┏━┓━━━━━━━━━━━━━━━━━━━┏━┓\n");
printf(" ┃ ┃ socat 圖書管理系統 ┃ ┃\n");
printf(" ┃ ┗━━━━━━━━━━━━━━━━━━━┛ ┃\n");
printf(" ┃ ●[1]圖書信息錄入 ┃\n");
printf(" ┃ ┃\n");
printf(" ┃ ●[2]圖書信息瀏覽 ┃\n");
printf(" ┃ ┃\n");
printf(" ┃ ●[3]圖書信息查詢 ┃\n");
printf(" ┃ ┃\n");
printf(" ┃ ●[4]圖書信息修改 ┃\n");
printf(" ┃ ┃\n");
printf(" ┃ ●[5]圖書信息刪除 ┃\n");
printf(" ┃ ┃\n");
printf(" ┃ ●[6]退出系統 ┃\n");
printf(" ┗━━━━━━━━━━━━━━━━━━━━━━━┛\n");
printf(" 請選擇:");
fflush(stdin);
scanf("%c",&choice);
if(choice=='1')
{
if(head==NULL)
{
head=Create_Books_Doc();
}
InsertDoc(head);
}
else if(choice=='2')
{
Print_Book_Doc(head);
}
else if(choice=='3')
{
search_book(head);
}
else if(choice=='4')
{
info_change(head);
}
else if(choice=='5')
{
DeleteDoc(head);
}
else if(choice=='6')
{
printf("\n");
printf(" ━━━━━━━━ 感謝使用圖書管理系統 ━━━━━━━━\n");
break;
}
else
{
printf(" ━━━━ 輸入錯誤,請重新輸入!━━━━");
break;
}
}
return 0;
}