文档介绍:C语言图书管理系统源代码
#include<> #include<> #include<>
#include<>
typedef struct
{ char name[10]; //姓名
char call[120]; //电话
char name1[20]; //书名
char numb[30]; //书号
}datatype;
typedef struct node {
datatype data;
struct node * next; }listnode;
typedef listnode * linklist;
linklist head;
listnode * p;
//图书馆用户信息的建立
linklist Create(int a ) {
linklist head=(listnode *)malloc(sizeof(listnode));
listnode *p,*q;
q=head;
while(a--)
{
p=(listnode *)malloc(sizeof(listnode));
printf("姓名 电话 书名 书号\n");
scanf("%s%s%s%s",p->,p->,p->,p->);
q->next=p;
q=p;
}
q->next=NULL;
return head;
}
//图书馆用户信息的添加
void Add(linklist head,int b)
{
listnode * m,* n,* p;
m=head;
n=m->next;
while(n->next!=NULL)
{
m=n;
n=n->next;
}
while(b--)
{
p=(listnode *)malloc(sizeof(listnode));
printf("姓名 电话 书名 书号\n");
printf("**********************\n");
scanf("%s%s%s%s",p->,p->,p->,p->);
n->next=p;
n=p;
}
n->next=NULL;
}
//按姓名查找用户信息
listnode * Find(linklist head) {
listnode *p;
char name[10];
int i;
printf("**********************\n");
printf("**********************\n");
printf("姓名查找,按1表示查找:");
p=head->next;
scanf("%d",&i);
if(i==1)
{
printf("请输入要查询的姓名:");
scanf("%s",&name);
while(p&&strcmp(p->,name)>0)
p=p->next;
if(p==NULL||strcmp(p->,name)<0)
p=NULL;
}
return p;
}
//按书名查找宾馆信息
listnode * Find1(linklist head) {
listnode *p;
char name1[20];
int i;
printf("**********************\n");
printf("**********************\n");
printf("书名查找,按1表示查找:");
p=head->next;
scanf("%d",&i);
if(i==1)
{
printf("请输入要查询的书名:");
scanf("%s",&name1);
while(p&&strcmp(p->,name1)>0)
p=p->next;
if(p==NULL||strcmp(p->,name1)<0)
p=NULL;
}
return p;
}
//按姓名信息的修改
void Alter(linklist head) {
listnode * p;
p= Find(head);