1-1
定義變量
struct node{
int book_number;//
書號
char book_name[25];//
書名
char press[50];//
出版社
char author[20];//
作者
int price;//
價(jià)格
char publication_date[20];//
出版日期
int number;//
館藏?cái)?shù)量
struct node * next;
};
struct node * head = NULL;//
在此定義一個(gè)全局變量
head,
其它函數(shù)就不需要再返回
head;
但這樣
做,程序中的函數(shù)的可用性就不是太高
int Total = 0; //
記錄圖書總數(shù)
1-2
函數(shù)的定義
void Creat();//
錄入圖書信息
struct node* Insert(struct node* p,struct node* head0);//
void Delete();//
刪除圖書信息
插入圖書信息
void change();//
修改圖書信息
void write();//
保存圖書信息
struct node * read();//
讀取圖書信息
void amend(struct node * p);//
輔助修改選項(xiàng)
void Print();//
遍歷圖書信息
void Print_by_one(struct node * p);//
單項(xiàng)遍歷
void Main_menu();//
登陸界面
void Administrator_menu0();//
第一次進(jìn)入系統(tǒng)的管理員菜單
void Administrator_menu1();//
第
n
次進(jìn)入系統(tǒng)的管理員菜單
void Student_menu();//
學(xué)生菜單
void mainFind();//
查找菜單
void Find();//
精確查找圖書
void Find0();//
模糊查找圖書
int str(char a[],char b[]);//
模糊查找函數(shù)
void Find_booknumber();//
按書號查找
void Find_booknumber0();//
按書號模糊查找
void Find_bookname();//
按書名查找
void Find_bookname0();//
按書名模糊查找
void Find_author(); //
按作者查找
void Find_author0(); //
按作者模糊查找
void Find_press(); //
按出版社查找
void Find_press0(); //
按出版社模糊查找
char *transform(char str[] ,int n);//
將整數(shù)轉(zhuǎn)化為字符存入字符數(shù)組返回
void Sorting_order();//
排序
void Sorting_help(struct node* p1,struct node* p2);//
輔助排序
void Sorting_booknumber();//
按書號排序
void Sorting_price();//
按價(jià)格排序
void Sorting_publication_date();//
按出版日期排序
void Sorting_number();//
按館藏?cái)?shù)量排序
#define S 123 //
學(xué)生密碼
#define A 123456//
管理員密碼
int T = 0;//
選擇菜單
1-3
信息的錄入
void Creat()//
錄入圖書信息
{
{
struct node *tail,*p;
int book_number;//
書號
char choice;
printf("
該操作將清除書庫中所有書目的信息!
printf("\n\t\t\t
你想繼續(xù)操作嗎
?(Y/N)\n"); while(1)
{
printf("
請選擇:
"); if(scanf("%c",&choice))
{
getchar();
if(choice == 'Y'||choice ==
'y'){ system("cls");
break;
}
else if(choice == 'N'||choice == 'n')
{
system("cls"); return;
}
else{
printf("
請按要求輸入!
\n"); continue;
}
}
else
printf("
輸入的不是字母,請按照要求重新輸入!
\n"); continue;
}
}
printf("\t\t\t
提示:請輸入你要輸入的數(shù)據(jù),當(dāng)書號為數(shù)字
'0'
時(shí)結(jié)束!
\n\n"); printf("
請輸入書
號
:");
scanf("%d",&book_number);
getchar();//
吸收回車符,清空緩沖區(qū),這樣才能正常執(zhí)行清屏操作
while(book_number != 0)
{
p = (struct node *)malloc(sizeof(struct node));
printf("
請輸入書名
:"); scanf("%s",p->book_name);getchar();
printf("
請輸入作者
:"); scanf("%s",p->author);getchar();
printf("
請輸入出版社
:"); scanf("%s",p->press);getchar();
\n");
printf("
請輸入價(jià)格
:"); scanf("%d",&p->price);getchar();
printf("
請輸入出版時(shí)間
:"); scanf("%s",p->publication_date);getchar();
printf("
請輸入館藏?cái)?shù)量
:");
scanf("%d",&p->number);getchar();
putchar('\n');
p->book_number = book_number;
p->next = NULL;
if(head == NULL)
{
head = tail = p;
}
else tail->next = p; tail = p;
}
Total++;
printf("
請輸入書號
:");
scanf("%d",&book_number);
}
printf("\t\t\t\t
圖書信息錄入成功!
\n\n");
}
1-4
按編號查詢
void Find_booknumber()//
按書號查找
{
int book_number;
struct node *p1,*p2;
printf("
請輸入你要查找的圖書書號:
");
scanf("%d",&book_number);
printf("\t\t\n
你要找的書為:
\n");
printf("\t\t ------------------------------------------------------------ \n");
printf("\t\t|
書號
|
書名
|
作者
|
出版社
|
價(jià)格
|
出版時(shí)間
|
館藏?cái)?shù)量
|\n");
printf("\t\t ------------------------------------------------------------ \n");
if(head->book_number == book_number)
{
Print_by_one(head);
}
p1 = head;
p2 = head->next;
while(p2 != NULL)
{
if(p2->book_number == book_number)
{Print_by_one(p2);
p1 = p2;
p2 = p2->next;
}
else
{
p1 = p2;
p2 = p2->next;
}
}
}
1-5
按出版時(shí)間排序
void Sorting_publication_date()//
按出版日期排序
{
struct node *p1,*p2,*p3,*p4,*p5,*p6,*p7;
int x=1;
for(p1=head;p1->next!=NULL;p4=p1,p1=p1->next)
{
p3=p1;
for(p2=p1->next,p5=p7=p2;p2!=NULL;p7=p2,p2=p2->next)
{
if(strcmp(p3->publication_date , p2->publication_date) >0)
{
p3=p2;
p5=p7;
}
}
if(p3!=p1)
{
if(x&&p1==head)
{
p6=p1->next;
p1->next=p3->next;
p3->next=p6;
p5->next=p1;
head=p3;
p1=p3;
x=0;
}
else
{
p6=p1->next;
p1->next=p3->next;
p3->next=p6;
p4->next=p3;
p5->next=p1;
p1=p3;
你是否還在尋找穩(wěn)定的海外服務(wù)器提供商?創(chuàng)新互聯(lián)www.cdcxhl.cn海外機(jī)房具備T級流量清洗系統(tǒng)配攻擊溯源,準(zhǔn)確流量調(diào)度確保服務(wù)器高可用性,企業(yè)級服務(wù)器適合批量采購,新人活動首月15元起,快前往官網(wǎng)查看詳情吧
專注于為中小企業(yè)提供做網(wǎng)站、
成都網(wǎng)站設(shè)計(jì)服務(wù),電腦端+手機(jī)端+微信端的三站合一,更高效的管理,為中小企業(yè)
寧津免費(fèi)做網(wǎng)站提供優(yōu)質(zhì)的服務(wù)。我們立足成都,凝聚了一批互聯(lián)網(wǎng)行業(yè)人才,有力地推動了上千多家企業(yè)的穩(wěn)健成長,幫助中小企業(yè)通過網(wǎng)站建設(shè)實(shí)現(xiàn)規(guī)模擴(kuò)充和轉(zhuǎn)變。
當(dāng)前名稱:c語言圖書信息管理系統(tǒng)程序-創(chuàng)新互聯(lián)
地址分享:http://newbst.com/article4/diheoe.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供服務(wù)器托管、App開發(fā)、關(guān)鍵詞優(yōu)化、響應(yīng)式網(wǎng)站、微信小程序、動態(tài)網(wǎng)站
廣告
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源:
創(chuàng)新互聯(lián)