資源簡介
廣東工業大學數據結構關于圖書管理系統課程設計

代碼片段和文件信息
#?include?
#?include?
#?include?
#?include?
#?include?
#define?m?3
#define?OK?1
#define?ERROR?0
#define?MAX?20
typedef?int?Status;
typedef?int?keytype;
typedef struct ReaderNode
{
?unsigned?long?int cardnum; //?證號
?char ????name[MAX+1]; ?//?姓名
?struct?ReaderNode?*next;//?下一個借閱者指針
?int????time; //借閱時間
}ReaderNode*ReaderType;
typedef?struct?BookNode{
???char?title[MAX+1];//?書名
???char?author[MAX+1];//?作者名
???int??currenttotal;//?現存量和總庫存
???ReaderType reader; //?借閱者鏈表指針
???ReaderType bespeaker;//?預約者鏈表指針 ???
}BookNode*BookType;
typedef?struct?BTNode{
???int????keynum;//結點關鍵字個數
???struct?BTNode?*parent;//指向雙親指針
???int????key[m];//關鍵字數組,0號單元未用
???BookNode?book[m];
???struct?BTNode?*ptr[m+1];//指向子樹指針
???int????leaf;
}BTNode*BTree;
int?x0;
int?y0;
short?x=8;
//*********************************經常調用的和一些基本函數*****************************************//
Status?EmptyNode(BTNode?*ptrint?i)//書結點初始化
{
??ptr->book[i].current=0;
??ptr->book[i].total=0;
??ptr->book[i].reader=NULL;
??ptr->book[i].bespeaker=NULL;
??ptr->book[i].title[0]=‘\0‘;
??ptr->book[i].author[0]=‘\0‘;
?return?OK;
}
void?gotoxy(int?xint?y)//坐標函數
{
?COORD?coord;
?coord.X=x;
?coord.Y=y;
?SetConsoleCursorPosition(?GetStdHandle(?STD_OUTPUT_HANDLE?)?coord?);
}
void?SetColor(unsigned?short?TextColor?)
//?設置字體和背景顏色
{?
HANDLE?hCon?=?GetStdHandle(STD_OUTPUT_HANDLE);?
SetConsoleTextAttribute(hConTextColor);?
}
void?Welcome(int?color)
//?顯示歡迎界面
{
SetColor(color);//界面顏色
gotoxy(25);
printf(“?????????╭╮╭╮╭──╮╭╮ ╭──╮╭──╮╭╭╮╮╭──╮\n“);
printf(“???????????│││││╭─╯││ │╭─╯│╭╮││ ││╭─╯\n“);
printf(“???????????│╰╯││╰─╮││ ││ │││││││││╰─╮\n“);
printf(“???????????│││││╭─╯││ ││ │││││╭╮││╭─╯\n“);
printf(“???????????│ ││╰─╮│╰─╮│╰─╮│╰╯││││││╰─╮\n“);
printf(“???????????╰╰╯╯╰──╯╰──╯╰──╯╰──╯╰╯╰╯╰──╯\n“);
SetColor(11);
printf(“???????????????????????╔══════════════╗\n“);
printf(“???????????????????????║????歡迎進入圖書管理系統????║\n“);
printf(“???????????????????????╚══════════════╝\n“);
}
void?head()//輸出格式
{
?printf(“?*--------------------------------------------------------------------------*\n“);
?printf(“?|??編號??|????????書名????????|???????作者名???????|??總庫存量?|??現庫存量?|\n“);
?printf(“?*--------------------------------------------------------------------------*\n“);??
}
void?Visit(BTree?T)//輸出圖書信息
{
?int?i=0;
?while(ikeynum)
?{
??printf(“?|%8d|%20s|%20s|????%4d???|????%4d???|\n“T->key[i]T->book[i].titleT->book[i].authorT->book[i].totalT->book[i].current);
??printf(“?*--------------------------------------------------------------------------*\n“);?
??i++;
?}
}
?
Status?InputChar(char?*a)//輸入字符串,并檢驗合法性
{
?int?i=0;
?char?k;
?while(1)
?{
??k=getch();
??if(i>=MAX)
??{
???printf(“\n輸入數據超出允許范圍請重新輸入!“);
???i=0;
???continue;
??}
??if(k==13)/*輸入的是回車就結束*/
??{
???if(i==0)
???{
????printf(“\n輸入不能為空請重新輸入!\
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????61440??2012-07-01?21:42??陳慶明3110005979\圖書管理.exe
?????文件??????18846??2008-01-01?05:53??陳慶明3110005979\圖書管理.c
?????文件?????452854??2008-01-01?06:00??陳慶明3110005979\課程設計實驗報告-圖書館管理系統.doc
?????目錄??????????0??2008-01-01?05:57??陳慶明3110005979
-----------?---------??----------?-----??----
???????????????533140????????????????????4
評論
共有 條評論