Ponyo_0 2015-03-27 03:02 采纳率: 0%
浏览 2343

C语言图书管理系统中出现的问题

该系统是采用了细分各个功能模块,分别在main.c文件中调用。
开发环境是Win7,Netbeans8.0.2

这是main.c
#include
#include
#include
#include "bmenu.h"
#include "search_allinformation.h"

typedef struct bookinfo {
char num[20]; /*图书编号*/
char name[40]; /*书名*/
char author[40]; /*作者*/
char publish [40]; /*出版社*/
double price; /*价格*/
} bi[40];

int w = 0; /*定义一个全局变量,用来记录bookinfo.txt文件中的数据个数*/

int main() {
int i = 0;
int choice1;
FILE fp;
printf(" * *
**************************** \n");
printf(" * 欢迎进入图书馆信息管理系统 *\n");
printf(" * *
**************************** \n");
fp = fopen("E:\BookInfo.txt", "r");
if (fp == NULL) {
printf("Can not open the file !\n");
exit(0);
}
while (!feof(fp)) {
fscanf(fp, "%s%s%s%s%lf", /
调用函数将文件中的数据读入结构变量中*/
&bi[i].num,&bi[i].name,&bi[i].author, &bi[i].publish, &bi[i].price);
i++;
}
w = i - 1;
fclose(fp);

do {
    bmenu();
    scanf("%d", &choice1);
    switch (choice1) {
        case 1:
            search_allinformation(bookinfo  &bi);
            break;
           case 2:
                check_bookinformation(b);
                break;
            case 3:
                add_bookinformation(b);
                break;
            case 4:
                delete_bookinformation(b);
                break;
            case 5:
                borrow_book(b);
                break;


        case 0:
            break;
    }
} while (choice1 != 0);
printf("谢谢使用!\n");


return 0;

}

这是bmenu.c

#include

void bmenu() {
printf("################################################################################");
printf(" 功能选项: \n");
printf(" 1:查看全部图书信息 \n");
printf(" 2:查找图书信息 \n");
printf(" 3:添加图书信息 \n");
printf(" 4:删除图书信息 \n");
printf(" 5:借阅图书 \n");
printf(" 0:退出系统 \n");
printf("################################################################################");
printf("请选择操作:");
}

这是bmenu.h
#ifndef BMENU_H
#define BMENU_H

#ifdef __cplusplus
extern "C" {
#endif

void bmenu();

#ifdef __cplusplus
}
#endif

#endif /* BMENU_H */

这是search_allinformation.c
#include

typedef struct list {
char num[20]; /*图书编号*/
char name[40]; /*书名*/
char author[40]; /*作者*/
char publish [40]; /*出版社*/
double price; /*价格*/
};
struct list b[40];

void search_allinformation(struct list b[],int w) {

int i;
int m = w;
printf("               ####################################\n");
printf("               #        查看全部图书信息!         #\n");
printf("               ####################################\n");
printf("图书的相关信息: 编号     书名      作者        出版社      价格\n");
for (i = 0; i < m; i++) {
    printf("                %s     %s     %s     %s     %.2f\n", /*将数据输出到屏幕中*/
            b[i].num, b[i].name, b[i].author, b[i].publish, b[i].price);
}


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

}

这是search_allinformation.h
#ifndef SEARCH_ALLINFORMATION_H
#define SEARCH_ALLINFORMATION_H

#ifdef __cplusplus
extern "C" {
#endif

typedef struct list {
char num[20]; /*图书编号*/
char name[40]; /*书名*/
char author[40]; /*作者*/
char publish [40]; /*出版社*/
double price; /*价格*/
};
struct list b[40];

void search_allinformation(struct list b[]);

#ifdef __cplusplus
}
#endif

#endif /* SEARCH_ALLINFORMATION_H */

出现的问题如下:

  • 写回答

3条回答

  • tjw123456 2015-03-28 07:04
    关注

    没看到你讲的出现的问题呀!

    评论

报告相同问题?

悬赏问题

  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大
  • ¥15 import arcpy出现importing _arcgisscripting 找不到相关程序