这是一个C语言写的书店管理系统
主要缺点:0,不能保存数据,每次重新运行,数据会刷新;
1,收银时会发生问题
#include "stdio.h"
#include "stdlib.h"
#include "string.h"
struct book{
char isdn[10];
char name[10];
char author[10];
char press[20];
int price;
int num;
}bookRecord[100];
//选择操作
int operate;
//书类的总量
int count = 0;
//采购管理
void add(){
/*
int i;
for( i = 0;i<=1;i++){
printf("\t\t\t输入条码:");
scanf("%s",bookRecord[i].isdn);
printf("\t\t\t输入名称:");
scanf("%s",bookRecord[i].name);
printf("\t\t\t输入作者:");
scanf("%s",bookRecord[i].author);
printf("\t\t\t输入出版社:");
scanf("%s",bookRecord[i].press);
printf("\t\t\t输入价格:");
scanf("%d",&bookRecord[i].price);
printf("\t\t\t输入数量:");
scanf("%d",&bookRecord[i].num);
}
*/
for (;;)
{
char exit;
int i = count;
int j = 0;
//书存在时的退出标志
int flage = 0;
printf("\t\t\t输入条码:");
scanf("%s",bookRecord[i].isdn);
//查找该书是否存在
/*
** 先必须有一本书,所以j = 1;此时count=0;因此不进行判断,之后count自增,开始判断
*/
for ( j = 1; j < count+1; j++ ) {
int add = 0;
//判断时从bookRecord[0]开始
//当isbn相同时,表示同一类书籍
if ( strcmp( bookRecord[j-1].isdn , bookRecord[i].isdn) == 0 )
{
flage = 1;
printf("\t\t\t作者:%s\n",bookRecord[j-1].author );
printf("\t\t\t出版社:%s\n",bookRecord[j-1].press );
/*
if ( strcmp( bookRecord[j-1].press , bookRecord[i].press) == 0 )
{
flage = 1;
printf("\t\t\t条码:%s\n",bookRecord[j-1].isdn );
printf("\t\t\t作者:%s\n",bookRecord[j-1].author );
printf("\t\t\t价格:%d\n",bookRecord[j-1].price );
//输入数量
printf("\t\t\t输入出版社:");
//修改出版社