没有合适的资源?快使用搜索试试~ 我知道了~
数据结构实验 教材管理系统 在vc环境
资源推荐
资源详情
资源评论
void shumingsearch(struct book *head) /*按教材名称查找*/
{ struct book *p;
char name[20];
int c;
if(head==NULL) {printf("未打开任何文件");getchar();return;}
printf("1,查找专业 2,查找教材名称:");
scanf("%d",&c);
getchar();
if(c==2)
printf("请输入要查找的教材名称:");
else printf("请输入要查找的专业:");
gets(name);
p=head;
do{ if(c==2)
if(strcmp(p->shuming,name)==0)
{
printf("教材编号:%s\n教材名称:%s\n数量:%d\n价格:%d\n专业:%s\n作者:%s\n出版社:%s\n备注:%s\n",p->number,p->shuming,p->shuliang,p->jiage,p->zhuanye,p->zuozhe,p->chubanshe,p->beizhu);
}
if(c==1)
if(strcmp(p->zhuanye,name)==0)
{
printf("教材编号:%s\n教材名称:%s\n数量:%d\n价格:%d\n专业:%s\n作者:%s\n出版社:%s\n备注:%s\n",p->number,p->shuming,p->shuliang,p->jiage,p->zhuanye,p->zuozhe,p->chubanshe,p->beizhu);
}
p=p->next;
}while(p!=NULL);
printf("查找完成");
return;
{ struct book *p;
char name[20];
int c;
if(head==NULL) {printf("未打开任何文件");getchar();return;}
printf("1,查找专业 2,查找教材名称:");
scanf("%d",&c);
getchar();
if(c==2)
printf("请输入要查找的教材名称:");
else printf("请输入要查找的专业:");
gets(name);
p=head;
do{ if(c==2)
if(strcmp(p->shuming,name)==0)
{
printf("教材编号:%s\n教材名称:%s\n数量:%d\n价格:%d\n专业:%s\n作者:%s\n出版社:%s\n备注:%s\n",p->number,p->shuming,p->shuliang,p->jiage,p->zhuanye,p->zuozhe,p->chubanshe,p->beizhu);
}
if(c==1)
if(strcmp(p->zhuanye,name)==0)
{
printf("教材编号:%s\n教材名称:%s\n数量:%d\n价格:%d\n专业:%s\n作者:%s\n出版社:%s\n备注:%s\n",p->number,p->shuming,p->shuliang,p->jiage,p->zhuanye,p->zuozhe,p->chubanshe,p->beizhu);
}
p=p->next;
}while(p!=NULL);
printf("查找完成");
return;
}
struct book *add(struct book *head) /*增加记录*/
{ struct book *p,*e,*f,*h;
if(head==NULL) {printf("未打开任何文件");getchar(); return NULL;}
h=f=e=head;
p=(struct book *)malloc(sizeof(struct book));
printf("\n教材编号:");
gets(p->number);
printf("\n教材名称:");
gets(p->shuming);
printf("\n数量:");
scanf("%d",&p->shuliang);
printf("\n价格:");
scanf("%d",&p->jiage);
getchar();
printf("\n专业:");
gets(p->zhuanye);
printf("\n作者:");
gets(p->zuozhe);
printf("\n出版社:");
gets(p->chubanshe);
printf("\n备注:");
gets(p->beizhu);
if(strcmp(f->number,p->number)>0) { p->next=f;h=p;printf("\n添加成功");return h;}
if(f->next==NULL) { f->next=p;p->next=NULL;printf("\n添加成功");return h;}
do{
struct book *add(struct book *head) /*增加记录*/
{ struct book *p,*e,*f,*h;
if(head==NULL) {printf("未打开任何文件");getchar(); return NULL;}
h=f=e=head;
p=(struct book *)malloc(sizeof(struct book));
printf("\n教材编号:");
gets(p->number);
printf("\n教材名称:");
gets(p->shuming);
printf("\n数量:");
scanf("%d",&p->shuliang);
printf("\n价格:");
scanf("%d",&p->jiage);
getchar();
printf("\n专业:");
gets(p->zhuanye);
printf("\n作者:");
gets(p->zuozhe);
printf("\n出版社:");
gets(p->chubanshe);
printf("\n备注:");
gets(p->beizhu);
if(strcmp(f->number,p->number)>0) { p->next=f;h=p;printf("\n添加成功");return h;}
if(f->next==NULL) { f->next=p;p->next=NULL;printf("\n添加成功");return h;}
do{
剩余9页未读,继续阅读
资源评论
congmingdexiaozhu
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功