我是大一新生,刚上完上半个学期,速求C语言,简单编写,图书管理系统,1、图书查看void look{}

2、图书修改voidfix{}3、图书删除voidpass{ss}... 2、图书修改void fix{}3、图书删除void pass{ss} 展开
 我来答
21绿毛水怪
2014-12-15 · 超过38用户采纳过TA的回答
知道小有建树答主
回答量:109
采纳率:0%
帮助的人:54.2万
展开全部
#include <stdio.h>

#include <string.h>

char menu()

{

char c[1];

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

printf ("1 Input the book's information.\n");

printf ("此首2 Input the book's number,display it's information.\n");

printf ("3 Give a key word,display\n");

printf ("4 Give the press\n");

printf ("5 Inquire the book according to the name and author\n");

printf ("6 Delete a book information\n");

printf ("7 Offer some informatiao\n");

printf ("8 exit\n");

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

printf (" please choose a number:");

scanf("%s",&c);

return *c;

}

struct book

{

char num[10];

char name[20];

char author[10];

char publish[10];

char time[10];

char kind[5];

char information[10];

};

struct book bo[3];

void c1()

{

int e;

e=0;

while(e<=2)

{

printf("Please input the number:");

scanf("%s",bo[e].num);

printf("Please input the name:");

scanf("%s",bo[e].name);

printf("Please input the author:");

scanf("%s",bo[e].author);

printf("Please input the publish:");

scanf("%s",bo[e].publish);

printf("Please input the publish time:");

scanf("%s",bo[e].time);

printf("Please input the kind,a or b:");

scanf("%s",bo[e].kind);

printf("Please input the information");

scanf("森颤数%s",bo[e].information);

printf("\nnum:%s\n",bo[e].num);

printf("name:%s\n",bo[e].name);

printf("author:%s\n",bo[e].author);

printf("publish:%s\n",bo[e].publish);

printf("time:%s\n",bo[e].time);

printf("kind:%s\n"洞带,bo[e].kind);

printf("information:%s\n",bo[e].information);

e++;

}

}

void c2()

{

char getnum[20];

int i;

printf("\nPlease input book ID");

scanf("%s",&getnum);

for(i=0;i<=2;i++)

{

if(strcmp(getnum,bo[i].num)==0)

{

printf("\nnum:%s\n",&bo[i].num);

printf("name:%s\n",&bo[i].name);

printf("author:%s\n",&bo[i].author);

printf("publish:%s\n",&bo[i].publish);

printf("time:%s\n",&bo[i].time);

printf("kind:%s\n",&bo[i].kind);

printf("information:%s\n",&bo[i].information);

break;

}

}

}

void c3()

{

int x;

char y[20];

int rtncode;

printf("\nPlease input the key word:");

scanf("%s",&y);

for(x=0;x<=2;x++);

{

rtncode = strpbrk(y,bo[x].name);

printf("check is :%d",rtncode);

if(rtncode > 0 )

{

printf("\nnum:%s\n",bo[x].num);

printf("name:%s\n",bo[x].name);

printf("author:%s\n",bo[x].author);

printf("publish:%s\n",bo[x].publish);

printf("time:%s\n",bo[x].time);

printf("kind:%s\n",bo[x].kind);

printf("information:%s\n",bo[x].information);

}

}

}

void c4()

{

char getpublish[20];

int m;

printf("\nPlease input the publish");

scanf("%s",&getpublish);

for(m=0;m<=2;m++)

{

if(strcmp(getpublish,bo[m].publish)==0)

{

printf("\nnum:%s\n",&bo[m].num);

printf("name:%s\n",&bo[m].name);

printf("author:%s\n",&bo[m].author);

printf("publish:%s\n",&bo[m].publish);

printf("time:%s\n",&bo[m].time);

printf("kind:%s\n",&bo[m].kind);

printf("information:%s\n",&bo[m].information);

break;

}

}

}

void c5()

{

char getx[20];

int l;

printf("\nPlease input book name or author");

scanf("%s",&getx);

for( l=0 ; l<=2 ; l++ )

{

if(strcmp(getx,bo[l].name)==0)

{

printf("\nnum:%s\n",&bo[l].num);

printf("name:%s\n",&bo[l].name);

printf("author:%s\n",&bo[l].author);

printf("publish:%s\n",&bo[l].publish);

printf("time:%s\n",&bo[l].time);

printf("kind:%s\n",&bo[l].kind);

printf("information:%s\n",&bo[l].information);

break;

}

else if(strcmp(getx,bo[l].author)==0)

{

printf("\nnum:%s\n",&bo[l].num);

printf("%name:%s\n",&bo[l].name);

printf("%author:%s\n",&bo[l].author);

printf("%publish:%s\n",&bo[l].publish);

printf("time:%s\n",&bo[l].time);

printf("kind:%s\n",&bo[l].kind);

printf("%information:%s\n",&bo[l].information);

break;

}

}

}

void c6()

{

int n;

printf("/nPlease input the num which you want to delete:");

scanf("%d",&n);

strcpy(bo[n].num,"0");

strcpy(bo[n].name,"0");

strcpy(bo[n].author,"0");

strcpy(bo[n].publish,"0");

strcpy(bo[n].time,"0");

strcpy(bo[n].kind,"0");

strcpy(bo[n].information,"0");

}

void c7()

{

int c,d,e;

d=0;

e=0;

for ( c=0 ; c<=2 ; c++)

{

if(strcmp("a",bo[c].kind)==0)

d++;

else if(strcmp("b",bo[c].kind)==0)

e++;

}

printf("The number of kind a:%d",d);

printf("The number of kind b:%d",e);

}

main()

{ char d;

do

{

d=menu();

if(d=='8')break;

switch (d)

{

case '1':c1();break;

case '2':c2();break;

case '3':c3();break;

case '4':c4();break;

case '5':c5();break;

case '6':c6();break;

case '7':c7();break;

default:printf("error\n");

}

}while(1);

}

可以把名字改改
追问
谢啦
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式