学生成绩管理系统c(2)

2018-12-17 13:10

} } } print(h); }

void chubanshesort(struct book *head) /*按出版社排序*/ { struct book *p,*t,*f,*h; char ch[20]; int i;

h=t=f=p=head;

if(head==NULL) {printf(\未打开任何文件\ f=p->next;

for(p=head;p->next!=NULL;p=p->next) {

for(t=head,f=t->next;t->next!=NULL;f=f->next,t=t->next) {

if(strcmp(t->chubanshe,f->chubanshe)>0) {

strcpy(ch,t->number ); strcpy(t->number,f->number); strcpy(f->number,ch);

strcpy(ch,t->shuming ); strcpy(t->shuming,f->shuming); strcpy(f->shuming,ch); i=t->shuliang ;

t->shuliang=f->shuliang; f->shuliang=i;

i=t->jiage ; t->jiage=f->jiage; f->jiage=i;

strcpy(ch,t->zhuanye); strcpy(t->zhuanye,f->zhuanye);

strcpy(f->zhuanye,ch);

strcpy(ch,t->zuozhe); strcpy(t->zuozhe,f->zuozhe); strcpy(f->zuozhe,ch);

strcpy(ch,t->chubanshe);

strcpy(t->chubanshe,f->chubanshe); strcpy(f->chubanshe,ch);

strcpy(ch,t->beizhu); strcpy(t->beizhu,f->beizhu); strcpy(f->beizhu,ch); } } } print(h); }

void shumingsearch(struct book *head) /*按教材名称查找*/ { struct book *p; char name[20];

int c;

if(head==NULL) {printf(\未打开任何文件\ printf(\,查找专业 2,查找教材名称:\ scanf(\ 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\anshe,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\anshe,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(\未打开任何文件\ h=f=e=head;

p=(struct book *)malloc(sizeof(struct book)); printf(\教材编号:\ gets(p->number); printf(\教材名称:\ gets(p->shuming); printf(\数量:\ scanf(\ printf(\价格:\ scanf(\ getchar(); printf(\专业:\ gets(p->zhuanye); printf(\作者:\ gets(p->zuozhe); printf(\出版社:\ gets(p->chubanshe); printf(\备注:\

gets(p->beizhu);

if(strcmp(f->number,p->number)>0) { p->next=f;h=p;printf(\添加成功\ if(f->next==NULL) { f->next=p;p->next=NULL;printf(\添加成功\ do{

if(f->next!=NULL)

if(strcmp(f->number,p->number)>0) {

e->next=p;p->next=f;printf(\添加成功\ }

if(f->next==NULL) {

f->next=p;

p->next=NULL; printf(\添加成功\ return h; } f=f->next; e=e->next; }while(1); }

struct book *delet(struct book *head) /*删除记录*/ { struct book *p,*e;

char num[20];

if(head==NULL) {printf(\未打开任何文件\ printf(\请输入要删除的教材编号:\ scanf(\ p=e=head;

if(strcmp(p->number,num)==0) { head=head->next; print(head);return head;} else p=p->next; do{

if(strcmp(p->number,num)==0) {

if(p->next!=NULL)

e->next=p->next; if(p->next==NULL) e->next=NULL;

print(head); return head; }

p=p->next; e=e->next; }while(p!=NULL);

printf(\搜索完毕,未找到该记录\ return head; }

struct book *change(struct book *head) /*修改记录*/ { struct book *p;

char num[20];

if(head==NULL) {printf(\未打开任何文件\ printf(\请输入要修改的教材编号:\ scanf(\ getchar(); p=head; do{

if(strcmp(p->number,num)==0) {

printf(\教材编号:%s\\n教材名称:%s\\n数量:%d\\n价格:%d\\n专业:%s\\n作者:%s\\n出版社:%s\\n备

注:%s\\n\anshe,p->beizhu);

printf(\教材编号:\ gets(p->number); printf(\教材名称:\ gets(p->shuming); printf(\数量:\ scanf(\ printf(\价格:\ scanf(\ getchar(); printf(\专业:\ gets(p->zhuanye); printf(\作者:\ gets(p->zuozhe); printf(\出版社:\ gets(p->chubanshe); printf(\备注:\


学生成绩管理系统c(2).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:2017年小学校长师德工作总结

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: