图书馆管理系统的中的实体类有哪些?
答案:4 悬赏:40
解决时间 2021-04-06 23:17
- 提问者网友:朱砂泪
- 2021-04-06 15:44
图书馆管理系统的中的实体类有哪些?
最佳答案
- 二级知识专家网友:统治我的世界
- 2021-04-06 16:44
最主要的就是图书和读者,一般还有管理员,其他的都不是主要的,要不要都行。
全部回答
- 1楼网友:转身后的回眸
- 2021-04-06 18:38
#include
#include
#include
#include
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+");
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)
{
struct books_list *s, *p;
char flag='y';
p=head;
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;
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 panduan=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");
panduan=1;
}
}
if(panduan==0)
{
printf("\n ━━━━ 没有图书记录! ━━━━\n\n");
}
return;
}
void deletedoc(struct books_list * head)
{
struct books_list *s,*p;
char temp[20];
int panduan;
panduan=0;
p=s=head;
printf(" [请输入您要删除的书名]:");
scanf("%s",temp);
while(p!= null)
{
if(strcmp(p->bookname,temp)==0)
{
panduan++;
break;
}
p=p->next;
}
if(panduan==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;
}
- 2楼网友:浪女动了心
- 2021-04-06 18:10
这个有点大,员工,图书你怎么设计存储,图书借阅,归还等都要建表地
- 3楼网友:输掉的尊严
- 2021-04-06 17:35
你这个问题问的大了。。。。基本上是以个表一个实体类。。。。。看你设计的有多少个表
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯