图书信息管理系统代码.docx

上传人:b****8 文档编号:10903353 上传时间:2023-02-23 格式:DOCX 页数:13 大小:15.99KB
下载 相关 举报
图书信息管理系统代码.docx_第1页
第1页 / 共13页
图书信息管理系统代码.docx_第2页
第2页 / 共13页
图书信息管理系统代码.docx_第3页
第3页 / 共13页
图书信息管理系统代码.docx_第4页
第4页 / 共13页
图书信息管理系统代码.docx_第5页
第5页 / 共13页
点击查看更多>>
下载资源
资源描述

图书信息管理系统代码.docx

《图书信息管理系统代码.docx》由会员分享,可在线阅读,更多相关《图书信息管理系统代码.docx(13页珍藏版)》请在冰豆网上搜索。

图书信息管理系统代码.docx

图书信息管理系统代码

#include

#include

#include

#defineN1000

intM=10;

structinformation

{

charbook_number[10],book_name[15],writter[10];

charpubnish_time[15];

floatprice;

}book[N]={{"999999","CProgram","A","2005-8",19.00},

{"000000","Mathes","B","2003-1",21.00},

{"111111","Harry","Prince","1999-9",18.00},

{"222222","Physics","Prince","2000-4",19.00},

{"333333","Biology","D","2004-2",21.00},

{"444444","WhiteSnow","Old","1998-7",14.00},

{"555555","Lion","Prince","2001-2",17.00},

{"666666","English","--","1864-2",19.00},

{"777777","TheWoods","Prince","2001-3",22.00},

{"888888","KuangRenRiJi","LuXun","1948-2",23.00}};

/*---------****************menu()****************--------*/

voidmenu()

{

intflag=1;

intchoose;

voidadd();

voiddele();

voidmodify();

voidbooknumberlookup();

voidbooknamelookup();

voidwritterlookup();

printf("\n\n\n\n");

printf("┏---------------------------------MENU--------------------------------┓\n");

printf("││\n");

printf("││\n");

printf("│1.AddMoreBooks│\n");

printf("│2.DeleteTheBooks│\n");

printf("│3、EditBookInformation│\n");

printf("│4、SearchasID│\n");

printf("│5、SearchAsTitle│\n");

printf("│6、SearchAsAuthor│\n");

printf("│0、Exit│\n");

printf("││\n");

printf("┗-------------------------------WelcomeToUse------------------------------┛\n\n\n\n\n\n");

printf("PleaseChoose(0-6):

");

scanf("%d",&choose);

if(choose<1||choose>6)

choose=0;

switch(choose)

{

case1:

add();break;

case2:

dele();break;

case3:

modify();break;

case4:

booknumberlookup();break;

case5:

booknamelookup();break;

case6:

writterlookup();break;

case0:

printf("\n\n\n");

printf("TTTTTTTHHHHHHANNNKKK\n");

printf("TTTHHAANNNKK\n");

printf("THHAANNNKK\n");

printf("THHHHHHAAAAANNNKKK\n");

printf("THHAAANNNKK\n");

printf("THHAANNNKK\n");

printf("TTTHHHHHHAAAANNNKKKK\n");

printf("\n");

printf("YYYYOOOOUU\n");

printf("YYOOUU\n");

printf("YYYOOUU\n");

printf("YOOUU\n");

printf("YOOUU\n");

printf("YOOUU\n");

printf("YYYOOOOUUUU\n");

printf("\n\n\n\n");

break;

}

}

/*---------****************add()****************---------*/

voidadd()

{

voidsystem();

inti,flag=1;

chark;

printf("\n\n\n\n\n\n\t\t\tWelcomeToAdding-BooksSystem!

\n\n\n\n\n\n\n\n");

while(flag)

{

printf("\n\nPleaseEnterBookInformation:

\n");

getchar();

printf("\tID:

");getchar();gets(book[M].book_number);

printf("Title:

");gets(book[M].book_name);

printf("Author:

");gets(book[M].writter);

printf("PublishTime:

");scanf("%s",book[M].pubnish_time);

printf("Price:

");scanf("%f",&book[M].price);

M++;

printf("ID\tTitle\t\tAuthor\tPublishTime\t\tPrice\n");

for(i=0;i

printf("%-10s%-20s%-15s%-10s\t\t%f\n",

book[i].book_number,

book[i].book_name,book[i].writter,

book[i].pubnish_time,book[i].price);

printf("AddMore(Y/N)?

\t:

");

getchar();

scanf("%c",&k);

if(k=='n'||k=='N')

flag=0;

}

menu();

}

/*---------****************dele()****************---------*/

voiddele()

{

voidsystem();

inti,j,flag=1;

charnum[10],c;

printf("\n\n\t\t\tWelcomeToBook-Deletingsysytem!

\n");

while(flag)

{

printf("\n\nPleaseentertheID:

");

scanf("%s",num);

for(i=0;i

if(strcmp(book[i].book_number,num)==0)

{

for(j=i;j

book[j]=book[j+1];

printf("Deleted!

\n");

M--;

break;

}

if(i==M)

printf("WrongEnter!

\n");

printf("ContinueOrExit(Y/N)?

:

");

getchar();

scanf("%c",&c);getchar();

if(c=='n'||c=='N')

flag=0;

}

menu();

}

/*---------****************modify()****************---------*/

voidmodify()

{voidsystem();

inti,k,flag=1,choose;

charnum[10],m;

printf("\n\n\t\t\tWelcomeToBook-EditingSystem!

\n");

while(flag)

{

getchar();

printf("PleaseEnterID:

");

gets(num);

k=0;

for(i=0;i

{

if(strcmp(book[i].book_number,num)==0)

{

printf("\n\nPriciousInformation:

\n");

printf("ID\tTitle\t\tAuthor\tPublishTime\t\tPrice\n");

printf("%-10s%-20s%-15s%-10s\t\t%f\n",book[i].book_number,book[i].book_name,book[i].writter,book[i].pubnish_time,book[i].price);

printf("\n1、EditTitle\n2、EditAuthor\n3、EditPublishTime\n4、EnditPrice\n5、EditAll\n");

printf("Choose(1-5):

");scanf("%d",&choose);getchar();

switch(choose)

{

case1:

printf("Title:

");gets(book[i].book_name);break;

case2:

printf("Author:

");gets(book[i].writter);break;

case3:

printf("PublishTime:

");

gets(book[i].pubnish_time);break;

case4:

printf("Price:

");scanf("%f",&book[i].price);break;

case5:

printf("Title:

");gets(book[i].book_name);printf("Author:

");gets(book[i].writter);printf("出版时间:

");

gets(book[i].pubnish_time);printf("Price:

");

scanf("%f",&book[i].price);

}

k=1;

printf("InformationAfterEditing:

\n");

printf("ID\tTitle\t\tAuthor\tPublishTime\t\tPrice\n");

printf("%-10s%-20s%-15s%-10s\t\t%f\n",book[i].book_number,

book[i].book_name,book[i].writter,book[i].pubnish_time,book[i].price);

}

}

getchar();

if(k==0)

printf("ErrorEnter!

\n");

printf("ConinueOrExit(Y/N)?

:

");

scanf("%c",&m);

if(m=='n'||m=='N')

flag=0;

}

menu();

}

/*---------****************booknumberlookup()****************---------*/

voidbooknumberlookup()

{

voidsystem();

inti,k,flag=1;

charnum[10];

charm;

printf("\n\n\t\t\tSearchAsID\n");

while(flag)

{

printf("PleaseEnterTheID:

");

scanf("%s",num);

k=0;

for(i=0;i

if(strcmp(book[i].book_number,num)==0)

{

printf("ID\tTitle\t\tAuthor\tPublishTime\t\tPrice\n");

printf("%-10s%-20s%-15s%-10s\t\t%f\n",book[i].book_number,book[i].book_name,book[i].writter,book[i].pubnish_time,book[i].price);

k=1;

}

if(k==0)

printf("ErrorEnter!

\n");

elseprintf("\n");

printf("ContinueOrExit(Y/N)?

");getchar();

scanf("%c",&m);

if(m=='n'||m=='N')

flag=0;

}

menu();

}

/*---------***************booknumberlookup()****************---------*/

voidbooknamelookup()

{

voidsystem();

inti,k,flag=1;

charnum[10];

charm;

printf("\n\n\t\t\tSearchAsTitle\n");

while(flag)

{

printf("PleaseEnterTitle:

");

scanf("%s",num);

k=0;

for(i=0;i

if(strcmp(book[i].book_name,num)==0)

{

printf("ID\tTitle\t\tAuthor\tPublishTime\t\tPrice\n");

printf("%-10s%-20s%-15s%-10s\t\t%f\n",book[i].book_number,book[i].book_name,book[i].writter,book[i].pubnish_time,book[i].price);

k=1;

}

if(k==0)

printf("ErrorEnter!

\n");

elseprintf("\n");

printf("ContinueOrExit(Y/N)?

");getchar();

scanf("%c",&m);

if(m=='n'||m=='N')

flag=0;

}

menu();

}

/*---------****************writterlookup()****************---------*/

voidwritterlookup()

{

voidsystem();

inti,k,flag=1;

charnum[10];

charm;

printf("\n\n\t\t\tSearchAsAuthor\n");

while(flag)

{

printf("PleaseEnterTheAuthor:

");

scanf("%s",num);

k=0;

for(i=0;i

if(strcmp(book[i].writter,num)==0)

{

printf("ID\tTitle\t\tAuthor\tPublishTime\t\tPrice\n");

printf("%-10s%-20s%-15s%-10s\t\t%f\n",book[i].book_number,book[i].book_name,book[i].writter,book[i].pubnish_time,book[i].price);

k=1;

}

if(k==0)

printf("ErrorEnter!

\n");

elseprintf("\n");

printf("ContinueOrExit(Y/N)?

");getchar();

scanf("%c",&m);

if(m=='n'||m=='N')

flag=0;

}

menu();

}

/*-----**********************main()********************-----*/

voidmain()

{

longinta;

inti,k;

printf("\n\n\n\t***********************welcometothesystem!

*******************\n\n\n\n");

printf("##################\n");

printf("#####################################\n");

printf("################\n");

printf("##########################\n");

printf("##############\n");

printf("####################################\n");

printf("######\n");

printf("WELCOMETO..................#####\n");

printf("........USETHELIBRARYSYSTEM##########\n\n");

printf("Subject:

LIBRARYSYSTEM\n\n");

printf("Language:

CLanguage\n\n");

for(i=0;;)

{

for(k=0;;)

{

printf("\tPleaseEnterTheCode:

");

scanf("%ld",&a);

printf("\n");

if(a!

=123456)

printf("Error!

PleaseTryAgain:

\n");

elsebreak;

}

printf("Logging.....\nWelcomeUSETHELIBRARYSYSTEM!

\n");

menu();break;

}

}

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 高等教育 > 管理学

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1