C语言,图书信息管理系统
C语言,图书信息管理系统不求功能多,但要有以下功能,最好不要有链表,最好有备注,可以看懂。谢谢,跪求!图书信息包括【书号,书名,作者,分类号,出版单位,出版时间,价格等】...
C语言,图书信息管理系统不求功能多,但要有以下功能,最好不要有链表,最好有备注,可以看懂。谢谢,跪求!
图书信息包括【书号,书名,作者,分类号,出版单位,出版时间,价格等】
要求设计一个图书管理系统,使之有以下功能
系统以菜单方式工作
图书信息录入功能-------录入
图书信息浏览功能------输出
图书信息查询功能:分别按书名查询和按作者查询。
图书信息删除功能:分别按书名删除和按书号删除。
图书信息修改功能:分别按书号修改和按书名修改。
图书插入功能:直接插入到数组的末尾。 展开
图书信息包括【书号,书名,作者,分类号,出版单位,出版时间,价格等】
要求设计一个图书管理系统,使之有以下功能
系统以菜单方式工作
图书信息录入功能-------录入
图书信息浏览功能------输出
图书信息查询功能:分别按书名查询和按作者查询。
图书信息删除功能:分别按书名删除和按书号删除。
图书信息修改功能:分别按书号修改和按书名修改。
图书插入功能:直接插入到数组的末尾。 展开
3个回答
2018-07-30 · 百度知道合伙人官方认证企业
育知同创教育
1【专注:Python+人工智能|Java大数据|HTML5培训】 2【免费提供名师直播课堂、公开课及视频教程】 3【地址:北京市昌平区三旗百汇物美大卖场2层,微信公众号:yuzhitc】
向TA提问
关注
展开全部
没有安装其他浏览器也没有关系,windows自带的有IE浏览器,进入百度一下页面,搜索
C++图书信息管理系统
,进入二级页面点击下载,选择路径即可
C++图书信息管理系统
,进入二级页面点击下载,选择路径即可
展开全部
//懒得写注释了。。哪儿想要注释就私信我吧。。全篇都写好麻烦
//希望能帮到你^_^
#include <stdio.h>
#include <string.h>
#define Total 20
typedef struct Time {
int year;
int month;
int day;
}Time;
struct Book {
int bookID;
char bookName[20];
char authorName[20];
int groupID;
char publishHouse[20];
Time publishTime;
double price;
int isVisible; //1-正常情况, 0-被删除
} book[Total];
int count = 0;
void inputInfo()
{
printf("Please input the number of books:\n");
scanf("%d", &count);
for (int i = 0; i < count; i ++) {
printf("Book %d:\n", i + 1);
printf("book ID:");
scanf("%d", &book[i].bookID);
getchar();
printf("book name:");
scanf("%s", book[i].bookName);
getchar();
printf("author name:");
scanf("%s", book[i].authorName);
printf("group ID:");
scanf("%d", &book[i].groupID);
getchar();
printf("publishing house:");
scanf("%s", book[i].publishHouse);
printf("publishing time:");
scanf("%d.%d.%d", &book[i].publishTime.year, &book[i].publishTime.month, &book[i].publishTime.day);
printf("book price:");
scanf("%lf", &book[i].price);
book[i].isVisible = 1;
}
printf("Input Complete!\n");
}
void outputInfo()
{
printf("BookID\tBookName\tAuthor\tGroupID\tPublishHouse\tTime\tprice\n");
for (int i = 0; i < count; i ++) {
if (book[i].isVisible == 1) {
printf("%d\t", book[i].bookID);
printf("%s\t", book[i].bookName);
printf("%s\t", book[i].authorName);
printf("%d\t", book[i].groupID);
printf("%s\t", book[i].publishHouse);
printf("%d.%d.%d\t",book[i].publishTime.year, book[i].publishTime.month, book[i].publishTime.day);
printf("%.2lf\t", book[i].price);
printf("\n");
}
}
}
void searchByBookName()
{
char name[20];
printf("Please input the name of the book:");
scanf("%s", name);
int i;
for (i = 0; i < count; i ++) {
if (strcmp(book[i].bookName, name) == 0 && book[i].isVisible == 1) {
printf("-----------------------------------------------\n");
printf("-- You are viewing the book: %s\n", name);
printf("-- Book ID: %d\n", book[i].bookID);
printf("-- Author: %s\n", book[i].authorName);
printf("-- Group ID: %d\n", book[i].groupID);
printf("-- Publishing House: %s\n", book[i].publishHouse);
printf("-- Publishing Time: %d.%d.%d\n",book[i].publishTime.year, book[i].publishTime.month, book[i].publishTime.day);
printf("-- Book Price: %lf\n", book[i].price);
printf("-----------------------------------------------\n");
return;
}
}
if (i == count)
printf("Not find the book you want.\n");
}
void searchByAuthorName()
{
char name[20];
printf("Please input the author's name of the book:");
scanf("%s", name);
int i;
for (i = 0; i < count; i ++) {
if (strcmp(book[i].authorName, name) == 0 && book[i].isVisible == 1) {
printf("-----------------------------------------------\n");
printf("-- You are viewing the book: %s\n", name);
printf("-- Book ID: %d\n", book[i].bookID);
printf("-- Author: %s\n", book[i].authorName);
printf("-- Group ID: %d\n", book[i].groupID);
printf("-- Publishing House: %s\n", book[i].publishHouse);
printf("-- Publishing Time: %d.%d.%d\n",book[i].publishTime.year, book[i].publishTime.month, book[i].publishTime.day);
printf("-- Book Price: %lf\n", book[i].price);
printf("-----------------------------------------------\n");
return;
}
}
if (i == count)
printf("Not find the book you want.\n");
}
void quertBook()
{
int choice;
printf("Do you want to search by book name or by author name? 0-book,1-author:");
scanf("%d", &choice);
if (choice == 0)
searchByBookName();
if (choice == 1)
searchByAuthorName();
}
void deleteByBookName()
{
char name[20];
printf("Please input the name of the book:");
scanf("%s", name);
int i;
for (i = 0; i < count; i ++) {
if (strcmp(book[i].bookName, name) == 0 && book[i].isVisible == 1) {
book[i].isVisible = 0;
printf("Delete Complete!\n");
return;
}
}
if (i == count)
printf("The book doesn't exist.\n");
}
void deleteByBookID()
{
int ID;
printf("Please input the ID of the book:");
scanf("%d", &ID);
int i;
for (i = 0; i < count; i ++) {
if (book[i].bookID == ID && book[i].isVisible == 1) {
book[i].isVisible = 0;
printf("Delete Complete!\n");
return;
}
}
if (i == count)
printf("The book doesn't exist.\n");
}
void deleteBook()
{
int choice;
printf("Do you want to delete by book name or by book ID? 0-name,1-ID:");
scanf("%d", &choice);
if (choice == 0)
deleteByBookName();
if (choice == 1)
deleteByBookID();
}
void modifyByBookName()
{
char name[20];
printf("Please input the name of the book:");
scanf("%s", name);
int i;
for (i = 0; i < count; i ++) {
if (strcmp(book[i].bookName, name) == 0 && book[i].isVisible == 1) {
printf("You are modifying the book: %s", book[i].bookName);
printf("Please reinput the entire info of the book:\n");
printf("Book %d:\n", i + 1);
printf("book ID:");
scanf("%d", &book[i].bookID);
getchar();
printf("book name:");
scanf("%s", book[i].bookName);
getchar();
printf("author name:");
scanf("%s", book[i].authorName);
printf("group ID:");
scanf("%d", &book[i].groupID);
getchar();
printf("publishing house:");
scanf("%s", book[i].publishHouse);
printf("publishing time:");
scanf("%d.%d.%d", &book[i].publishTime.year, &book[i].publishTime.month, &book[i].publishTime.day);
printf("book price:");
scanf("%lf", &book[i].price);
book[i].isVisible = 1;
printf("Modification Complete!\n");
return;
}
}
if (i == count)
printf("The book doesn't exist.\n");
}
void modifyByBookID()
{
int ID;
printf("Please input the ID of the book:");
scanf("%d", &ID);
int i;
for (i = 0; i < count; i ++) {
if (book[i].bookID == ID && book[i].isVisible == 1) {
printf("You are modifying the book: %s", book[i].bookName);
printf("Please reinput the entire info of the book:\n");
printf("Book %d:\n", i + 1);
printf("book ID:");
scanf("%d", &book[i].bookID);
getchar();
printf("book name:");
scanf("%s", book[i].bookName);
getchar();
printf("author name:");
scanf("%s", book[i].authorName);
printf("group ID:");
scanf("%d", &book[i].groupID);
getchar();
printf("publishing house:");
scanf("%s", book[i].publishHouse);
printf("publishing time:");
scanf("%d.%d.%d", &book[i].publishTime.year, &book[i].publishTime.month, &book[i].publishTime.day);
printf("book price:");
scanf("%lf", &book[i].price);
book[i].isVisible = 1;
printf("Modification Complete!\n");
return;
}
}
if (i == count)
printf("The book doesn't exist.\n");
}
void modifyBook()
{
int choice;
printf("Do you want to modify by book name or by book ID? 0-name,1-ID:");
scanf("%d", &choice);
if (choice == 0)
modifyByBookName();
if (choice == 1)
modifyByBookID();
}
void insertBook()
{
printf("Please input the info of the book you want to insert\n");
printf("Book %d:\n", count + 1);
printf("book ID:");
scanf("%d", &book[count].bookID);
getchar();
printf("book name:");
scanf("%s", book[count].bookName);
getchar();
printf("author name:");
scanf("%s", book[count].authorName);
printf("group ID:");
scanf("%d", &book[count].groupID);
getchar();
printf("publishing house:");
scanf("%s", book[count].publishHouse);
printf("publishing time:");
scanf("%d.%d.%d", &book[count].publishTime.year, &book[count].publishTime.month, &book[count].publishTime.day);
printf("book price:");
scanf("%lf", &book[count].price);
book[count].isVisible = 1;
count ++;
printf("Insert Complete!\n");
}
void menu()
{
printf("---------------------------------\n");
printf("-- 1 - input data --\n");
printf("-- 2 - output data --\n");
printf("-- 3 - search for a book --\n");
printf("-- 4 - delete a book --\n");
printf("-- 5 - modify info of a book --\n");
printf("-- 6 - insert data --\n");
printf("-- 0 - exit --\n");
printf("---------------------------------\n");
}
int main() {
int choice;
menu();
scanf("%d", &choice);
while (choice != 0){
switch (choice) {
case 1:
inputInfo();
break;
case 2:
outputInfo();
break;
case 3:
quertBook();
break;
case 4:
deleteBook();
break;
case 5:
modifyBook();
break;
case 6:
insertBook();
break;
default:
break;
}
menu();
scanf("%d", &choice);
}
return 0;
}
更多追问追答
追问
请问,用到了链表吗
追答
没有。。就是数组。。全局变量
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
程序有点大
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询