图书管理系统C项目介绍
图书管理系统C是一个简单的计算机程序,用于管理图书馆的图书。这个程序可以让用户查看和添加新的图书,修改和删除已有的图书,以及搜索和浏览图书。本程序使用了C语言作为编程语言,并使用了一个Windows操作系统。
程序的主要功能和界面如下:
1. 用户登录:用户可以通过用户名和密码登录系统。
2. 图书添加:用户可以通过输入图书的书名、作者、出版社、ISBN号码等信息来添加新的图书。
3. 图书修改:用户可以通过输入新的书名、作者、出版社、ISBN号码等信息来修改已有的图书。
4. 图书删除:用户可以通过输入书名、作者、出版社、ISBN号码等信息来删除已有的图书。
5. 图书搜索:用户可以通过输入关键词来搜索已有的图书。
6. 用户管理:用户可以查看自己的库存,并查看其他用户的库存。
下面是程序的主要代码:
“`
#include
#include
#include
// 定义全局变量
int num_books = 0;
// 定义全局函数
void add_book(char *title, char *author, char *publisher, char *isbn) {
printf(\”请输入书名:\”);
scanf(\”%s\”, title);
printf(\”请输入作者:\”);
scanf(\”%s\”, author);
printf(\”请输入出版社:\”);
scanf(\”%s\”, publisher);
printf(\”请输入ISBN号码:\”);
scanf(\”%s\”, isbn);
num_books++;
printf(\”图书添加成功!\\n\”);
}
void delete_book(char *title, char *author, char *publisher, char *isbn) {
printf(\”请输入书名:\”);
scanf(\”%s\”, title);
printf(\”请输入作者:\”);
scanf(\”%s\”, author);
printf(\”请输入出版社:\”);
scanf(\”%s\”, publisher);
printf(\”请输入ISBN号码:\”);
scanf(\”%s\”, isbn);
printf(\”请输入要删除的书名:\”);
scanf(\”%s\”, isbn);
num_books–;
printf(\”图书删除成功!\\n\”);
}
void search_book(char *title, char *author, char *publisher, char *isbn) {
printf(\”请输入书名:\”);
scanf(\”%s\”, title);
printf(\”请输入作者:\”);
scanf(\”%s\”, author);
printf(\”请输入出版社:\”);
scanf(\”%s\”, publisher);
printf(\”请输入ISBN号码:\”);
scanf(\”%s\”, isbn);
printf(\”请输入要搜索的书名:\”);
scanf(\”%s\”, isbn);
int index = 0;
while ((index = strstr(title, author))!= NULL) {
if (index < num_books) {
printf(\"书名:%s\\n\", title);
return;
}
}
if (strstr(title, publisher)!= NULL) {
printf(\"出版社:%s\\n\", publisher);
}
if (strstr(title, author)!= NULL) {
printf(\"作者:%s\\n\", author);
}
}
void display_books() {
printf(\"库存:\");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\"已借:\");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\"已还:\");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
printf(\" \");
}
int main() {
char *title;
char *author;
char *publisher;
char *isbn;
int choice;
while (1) {
printf(\"请选择操作:\\n\");
printf(\"1. 添加图书\\n\");
printf(\"2. 修改图书\\n\");
printf(\"3. 删除图书\\n\");
printf(\"4. 搜索图书\\n\");
printf(\"5. 显示所有图书\\n\");
printf(\"6. 退出程序\\n\");
printf(\"请输入操作:\");
scanf(\"%d\", &choice);
switch (choice) {
case 1:
add_book(\"Book 1\", \"John Smith\", \"ABC出版社\", \"098001\");
add_book(\"Book 2\", \"Jane Doe\", \"XYZ出版社\", \"098002\");
add_book(\"Book 3\", \"Bob Johnson\", \"ABC出版社\", \"098003\");
break;
case 2:
printf(\"图书添加成功!\\n\");
break;
case 3:
printf(\"图书添加成功!\\n\");
break;
case 4:
printf(\"图书添加成功!\\n\");
break;
case 5:
printf(\"图书添加成功!\\n\");
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。