我运行代码连接好像有问题,学生链表

#includestdio.h#includestdlib.h#includemath.h#includemalloc.h#defineOK1#defineEQX56RO索罗德0typedefintStatus;typedefintElemType;typedefstructStaff//音信结构体{charname[10];//姓名charsex[5];//性别intCyear;//出生年,月,日intCmonth;intCday;intGyear;//工作年,月,日intGmonth;intGday;charXueLi[10];//学历charZhiWu[10];//职务charAdress[10];//地址intnum;//手提式有线电话机号码}Staff;typedefstructLNode{Staffdata;structLNode*next;}LNode;/*typedefstruct//扶助构造体{Staffdata;structLNode*next;}MNode;*/voidVoidList(LNode*t1卡塔尔国//创设链表表头{if(t1=(LNode*)malloc(sizeof(LNode))){exit(1);}t1-next=NULL;}StatusCreatList(LNode*t1卡塔尔//职工新闻插入以至排序{LNode*a1,*a2,*a3;a2=t1-next;if(a1=(LNode*卡塔尔(قطر‎malloc(sizeof(LNode卡塔尔(قطر‎卡塔尔(قطر‎卡塔尔国{returnE凯雷德RO传祺;}printf(“请输入职工信息:\n”);printf(“姓名:\n”);scanf(“%s”,a1-data.name);printf(“性别:\n”卡塔尔国;scanf(“%s”,a1-data.sex卡塔尔国;printf(“出生年月日(分别以逗号(,卡塔尔结尾.State of Qatar:\n”卡塔尔(قطر‎;scanf(“%d,%d,%d”,(a1-data.Cyear卡塔尔,(a1-data.Cmonth卡塔尔,(a1-data.CdayState of Qatar卡塔尔(قطر‎;printf(“专门的工作年月日(分别以逗号(,卡塔尔国结尾State of Qatar:\n”);scanf(“%d,%d,%d”,(a1-data.Gyear),(a1-data.Gmonth),(a1-data.Gday));printf(“学历:\n”);scanf(“%s”,a1-data.XueLi);printf(“职务:\n”);scanf(“%s”,a1-data.ZhiWu);printf(“住址:\n”State of Qatar;scanf(“%s”,a1-data.Adress卡塔尔国;printf(“电话号码:\n”);scanf(“%d”,a1-data.num);if(t1-next==NULL){t1-next=a1;t1-next-next=NULL;}else{for(;a2;a2=a2-next){if(a2-next!=NULL卡塔尔(قطر‎//在两个之间插入{if((strcmp(a2-data.name,a1-data.nameState of Qatar0卡塔尔国(strcmp(a2-next-data.name,a1-data.name卡塔尔0卡塔尔国State of Qatar{a1-next=a2-next;a2-next=a1;break;}}elseif(strcmp(a2-data.name,a1-data.name卡塔尔(قطر‎==0State of Qatar//姓名相仿不录入{break;}elseif((strcmp(a2-data.name,a1-data.name卡塔尔0卡塔尔(a2-next==NULLState of Qatar卡塔尔国//链表非空,且排在最终叁个{a2-next=a1;a1-next=NULL;break;}else//链表非空,且在头结点后排列if(strcmp(a2-data.name,a1-data.nameState of Qatar0卡塔尔国{a3=t1-next;t1-next=a1;a1-next=a3;break;}}}returnOK;}voidput(LNode*t1,FILE*fp){LNode*m1;m1=t1-next;if((fp=fopen(“职工音信.txt”,”w”卡塔尔国卡塔尔==NULL卡塔尔国{//若无该公文printf(“不可能开采’职工新闻.txt’!\n”State of Qatar;exit(0卡塔尔国;}for(;m1;m1=m1-next卡塔尔国{//文件中写入fprintf(fp,”%s%s%d%d%d%d%d%d%%s%s%s%d”,m1-data.name,m1-data.sex,m1-data.Cyear,m1-data.Cmonth,m1-data.Cday,m1-data.Gyear,m1-data.Gmonth,m1-data.Gday,m1-data.XueLi,m1-data.ZhiWu,m1-data.Adress,m1-data.num卡塔尔;}if(fclose(fp卡塔尔(قطر‎State of Qatar{printf(“不能够关闭’职工消息.txt’!\n”卡塔尔国;exit(0卡塔尔(قطر‎;//不荒谬退出}}voidPrint(LNode*t1卡塔尔国//打字与印刷当前职员和工人消息{inti=0;LNode*q1;q1=t1-next;printf(“职工音信如下:\n”卡塔尔国;printf(“姓名性别出生年月工作年月文化水平任务住址电话\n”);while(q1!=NULL){printf(“%s”,q1-data.name);printf(“%s”,q1-data.sex);printf(“%d%d%d”,q1-data.Cyear,q1-data.Cmonth,q1-data.Cday);printf(“%d%d%d”,q1-data.Gyear,q1-data.Gmonth,q1-data.Gday);printf(“%s”,q1-data.XueLi);printf(“%s”,q1-data.ZhiWu);printf(“%s”,q1-data.Adress);printf(“%d\n”,q1-data.num);q1=q1-next;i=i+1;}printf(“一共%d个员工!”,i);}StatusDelete(LNode*t1卡塔尔//删除工作者操作{charname1[10];LNode*q2,*q3;q2=t1;q3=t1-next;if(q3==NULLState of QatarreturnEMuranoROCR-V;printf(“请输入您要删减的职工的姓名:\n”State of Qatar;scanf(“%s”,name1卡塔尔(قطر‎;for(;q3;q3=q3-next卡塔尔{if(strcmp(q3-data.name,name1卡塔尔国==0State of Qatar{q2-next=q3-next;free(q3State of Qatar;printf(“删除成功,请继续操作!\n”卡塔尔(قطر‎;break;}q2=q3;}if(q3==NULL卡塔尔{printf(“无职工音信,没有要求删除操作.\n”);}returnOK;}StatusSearch(LNode*t1State of Qatar//查询某些职工{charname2[10];intselect,flag1=0,flag2=0,num1;LNode*s1;s1=t1-next;if(s1==NULL卡塔尔returnE瑞虎RO瑞虎;printf(“请输入您要找寻的人的口径:”卡塔尔(قطر‎;do{printf(“***************\n”卡塔尔(قطر‎;printf(“1.按姓名查找.\n”卡塔尔;printf(“2.按电话查找.\n”卡塔尔;printf(“0.了事操作.\n”);printf(“***************\n”卡塔尔国;scanf(“%d”,select卡塔尔国;switch(select卡塔尔{case1:printf(“请输入要物色的人的姓名:\n”卡塔尔国;scanf(“%s”,name2State of Qatar;for(;s1;s1=s1-next卡塔尔{if(strcmp(s1-data.name,name2卡塔尔==0卡塔尔国{printf(“这么些职员和工人的消息是:\n”);pirntf(“姓名:\n”);printf(“%s”,s1-data.name);printf(“性别:\n”State of Qatar;printf(“%s”,s1-data.sex卡塔尔国;printf(“出生年月日:\n”卡塔尔国;printf(“%5d%2d%2d”,s1-data.Cyear,s1-data.Cmonth,s1-data.Cday卡塔尔;printf(“职业年月日:\n”);printf(“%5d%2d%2d”,s1-data.Gyear,s1-data.Gmonth,s1-data.Gday);printf(“学历:\n”);printf(“%s”,s1-data.XueLi);printf(“职务:\n”);printf(“%s”,s1-data.ZhiWu);printf(“住址:\n”);printf(“%s”,s1-data.Adress);printf(“电话:\n”卡塔尔;printf(“%d”,s1-data.numState of Qatar;flag1=1;break;}}if(flag1=0State of Qatar{printf(“对不起,未有查到那几个职工的新闻.\n”卡塔尔国;}break;case2:printf(“请输入要查询者的对讲机号码.\n”卡塔尔(قطر‎;scanf(“%d”,num1卡塔尔国;for(;s1;s1=s1-next卡塔尔(قطر‎{if(s1-data.num==num1卡塔尔{printf(“这几个工作者的音讯是:\n”);pirntf(“姓名:\n”);printf(“%s”,s1-data.name);printf(“性别:\n”卡塔尔;printf(“%s”,s1-data.sexState of Qatar;printf(“出生年月日:\n”State of Qatar;printf(“%5d%2d%2d”,s1-data.Cyear,s1-data.Cmonth,s1-data.Cday卡塔尔(قطر‎;printf(“工作年月日:\n”);printf(“%5d%2d%2d”,s1-data.Gyear,s1-data.Gmonth,s1-data.Gday);printf(“学历:\n”);printf(“%s”,s1-data.XueLi);printf(“职务:\n”);printf(“%s”,s1-data.ZhiWu);printf(“住址:\n”);printf(“%s”,s1-data.Adress);printf(“电话:\n”卡塔尔;printf(“%d”,s1-data.numState of Qatar;flag2=1;break;}}if(flag2==0State of Qatarprintf(“对不起,未有查询到非常职工的新闻.\n”卡塔尔国;break;case0:printf(“甘休操作.\n”State of Qatar;break;default:printf(“输入采抽取错!\n”);}}while(select!=0);returnOK;}voidAmend(LNode*t1卡塔尔//改过有些职员和工人的有些音讯{intn,tag=0;intscyear,scmonth,scday,sgyear,sgmonth,sgday,snum;charsname[10],ssex[5],sxue[10],szhi[10],sadress[10];charname3[10];LNode*s2;s2=t1-next;if(t1-next==NULLState of Qatar{printf(“未有得以改正的学子.\n”卡塔尔(قطر‎;return;}printf(“请输入要改革职员和工人的全名:\n”卡塔尔国;scanf(“%s”,name3卡塔尔国;for(;s2;s2-next卡塔尔(قطر‎{if(strcmp(s2-data.name,name3卡塔尔(قطر‎==0State of Qatar{tag=1;do{printf(“请输入您想纠正的有些:\n”);printf(“***************\n”卡塔尔;printf(“0.脱离校订.\n”);printf(“1.姓名\n”);printf(“2.性别\n”卡塔尔国;printf(“3.名落孙山年月日\n”卡塔尔(قطر‎;printf(“4.行事年月日\n”);printf(“5.学历\n”);printf(“6.职务\n”);printf(“7.住址\n”卡塔尔;printf(“8.电话号码\n”);printf(“***************\n”卡塔尔(قطر‎;scanf(“%d”,n卡塔尔国;switch(n卡塔尔国{case1:printf(“请输入想校勘的名字:\n”卡塔尔;scanf(“%s”,sname卡塔尔(قطر‎;strcpy(s2-data.name,sname卡塔尔;printf(“校勘完结,请继续操作.\n\n”卡塔尔国;break;case2:printf(“请输入想改过的性别:\n”State of Qatar;scanf(“%s”,ssex卡塔尔;strcpy(s2-data.sex,ssex卡塔尔国;printf(“更正完成,请继续操作.\n\n”卡塔尔国;break;case3:printf(“请输入想改过的出生年月日.\n”State of Qatar;scanf(“%d%d%d”,scyear,scmonth,scdayState of Qatar;s2-data.Cyear=scyear;s2-data.Cmonth=scmonth;s2-data.Cday=scday;printf(“校勘落成,请继续操作.\n\n”State of Qatar;break;case4:printf(“请输入要改正的行事时间.\n”卡塔尔(قطر‎;scanf(“%d%d%d”,sgyear,sgmonth,sgday卡塔尔;s2-data.Gyear=sgyear;s2-data.Gmonth=sgmonth;s2-data.Gday=sgday;printf(“修改完成,请继续操作.\n\n”卡塔尔(قطر‎;break;case5:printf(“请输入想校正的文化水平.\n”卡塔尔(قطر‎;scanf(“%s”,sxue卡塔尔;strcpy(s2-data.XueLi,sxue卡塔尔国;printf(“修正完结,请继续操作.\n\n”卡塔尔(قطر‎;break;case6:printf(“请输入想校订的任务.\n”卡塔尔;scanf(“%s”,szhiState of Qatar;strcpy(s2-data.ZhiWu,szhiState of Qatar;printf(“修正完毕,请继续操作.\n\n”State of Qatar;break;case7:printf(“请输入想纠正的住址.\n”卡塔尔(قطر‎;scanf(“%s”,sadress卡塔尔;strcpy(s2-data.Adress,sadress卡塔尔(قطر‎;printf(“更正达成,请继续操作.\n\n”卡塔尔;break;case8:printf(“请输入想修正的号码.\n”卡塔尔;scanf(“%d”,snumState of Qatar;s2-data.num=snum;printf(“改良落成,请继续操作.\n\n”卡塔尔(قطر‎;break;case0:printf(“退出操作.\n”卡塔尔国;break;default:printf(“您的取舍现身了难题,请重新选取.\n”);}}while(n!=0卡塔尔国;}}if(tag==0卡塔尔pirntf(“抱歉,您输入的人一纸空文.\n”);}voidmain(){inti;FILE*fp;LNodet,*T;T=t;VoidList(T);do{printf(“*******************\n”State of Qatar;printf(“1.新扩张一名职员和工人.\n”卡塔尔(قطر‎;printf(“2.删减一名职员和工人.\n”卡塔尔国;printf(“3.询问一名工作者(根据名字或号码卡塔尔(قطر‎\n”卡塔尔国;printf(“4.输入名字,校订对应职员和工人的质量\n”卡塔尔;printf(“0.脱离操作.\n”);printf(“*******************\n”卡塔尔;printf(“请输入您想操作的数字.\n”卡塔尔(قطر‎;scanf(“%d”,i卡塔尔(قطر‎;switch(iState of Qatar{case1:if(CreatList(T卡塔尔(قطر‎==0卡塔尔printf(“创制出错.\n”卡塔尔;elseprintf(“新闻建构成功.\n”卡塔尔(قطر‎;put(T,fpState of Qatar;printf(“打字与印刷输出当前音信.\n”);Print(T);printf(“\n”卡塔尔(قطر‎;printf(“请继续操作.\n\n”State of Qatar;break;case2:Delete(TState of Qatar;//判别文件是不是写入.if((fp=fopen(“职工音讯.txt”,”w”卡塔尔卡塔尔==NULL卡塔尔国{printf(“不能展开’职工音信.txt’!\n”卡塔尔(قطر‎;exit(0State of Qatar;}put(T,fp卡塔尔;if(fclose(fp卡塔尔(قطر‎卡塔尔国{printf(“不能关闭’职工消息.txt’!\n”卡塔尔(قطر‎;exit(0卡塔尔国;}printf(“打印输出当前音信.\n”);Print(T);printf(“\n”State of Qatar;printf(“请继续操作.\n\n”卡塔尔;break;case3:Search(T卡塔尔国;printf(“打字与印刷输出当前新闻.\n”);Print(T);printf(“\n”卡塔尔国;printf(“请继续操作.\n\n”卡塔尔国;break;case4:Amend(T卡塔尔;if((fp=fopen(“职工信息.txt”,”w”卡塔尔(قطر‎卡塔尔==NULL卡塔尔{printf(“不能够开垦’职工消息.txt’!\n”卡塔尔国;exit(0卡塔尔国;}put(T,fp卡塔尔(قطر‎;if(fclose(fp卡塔尔国State of Qatar{printf(“不能关闭’职工新闻.txt’!\n”卡塔尔;exit(0卡塔尔(قطر‎;}printf(“打字与印刷输出当前音信.\n”);Print(T);printf(“\n”State of Qatar;printf(“请继续操作.\n\n”卡塔尔国;break;case0:printf(“操作已脱离,感激您的使用.\n”);break;}}while(i!=0);//switch/*VoidList(T卡塔尔;创制空链表CreatList(T卡塔尔国;对空链表举行赋值,工作者新闻Print(T卡塔尔(قطر‎;打字与印刷输出工作者消息Delete(T卡塔尔(قطر‎;删除某些工作者音讯Search(T卡塔尔;搜寻某些职工新闻Amend(T卡塔尔国;改进有些工作者新闻*/}/*主导必要:职工对象包含姓名、性别、出生年月、工时、教育水平、职责、住址电话等音信。新添一名职员和工人:将猛增对象按姓名以辞书方式职工管理文件中。删除一名工作者:从工作者管理文件中删除一名职工对象。查询:从工作者管理文件中询问切合某个标准的职工。改革:检索有个别职工对象,对其有些性能举办校正。排序:按某种须求对工作者文件对象开展排序。*/

运作有荒谬,不掌握错在哪,求解。代码如下:#includestdio.h#includestdlib.h#includestring.h#defineERROR0#defineOK1typedefintStatus;typedefstruct//学子消息种类{charnum[8];charname[10];floatscore;}student;typedefstudentElemType;typedefstructLNode{ElemTypedata;structLNode*next;}LNode,*LinkList;//LinkList为指向构造体LNode的指针类型StatusGetElem(LinkListL,inti,ElemTypeeState of Qatar//链表的取值{//在起头结点的单链表中L依照序号i获取成分的值,用e再次回到L中第i个数据成分的值LNode*p;intj;p=L-next;j=1;while(pji){p=p-next;++j;}if(!p||ji)returnERROR;e=p-data;returnOK;}LNode*LocateElem(LinkListL,ElemTypee卡塔尔//链表的按值查找{//在起头结点的单链表L中查找值为e的要素LNode*p;p=L-next;while(pp-data.name!=e.name卡塔尔(قطر‎p=p-next;returnp;}StatusListInsert(LinkListL,inti,ElemTypee卡塔尔(قطر‎//链表的插入操作{//在起头结点的单链表L中第i个职位插入值为e的新结点LNode*p=L,*s;intj=0;while(p(ji-1)){p=p-next;++j;}if(!p||ji-1State of QatarreturnECR-VRO昂科雷;s=newLNode;s-data=e;s-next=p-next;p-next=s;returnOK;}StatusListDelete(LinkListL,inti卡塔尔//链表的删减操作{//在领头结点的单链表L中,删除第i个要素LNode*p=L,*q;intj=0;while((p-next)(ji-1)){p=p-next;++j;}if(!(p-next)||(ji-1))returnERROR;q=p-next;p-next=q-next;deleteq;returnOK;}intCreateList_皇家国际娱乐手机版,H(LinkListL,intn卡塔尔//前插法创立单链表{//逆位序输入n个成分的值,建构带表头结点的单链表inti;LNode*p;L=newLNode;L-next=NULL;for(i=0;in;i++){p=newLNode;printf(“学号:”);scanf(“%s”,p-data.num);printf(“\n”);getchar();printf(“姓名:”);scanf(“%s”,p-data.name);printf(“\n”);printf(“成绩:”);scanf(“%.2f”,p-data.score);p-next=L-next;L-next=p;}printf(“\n”);returnOK;}voidmain(){LinkListL;intk,m,x,y,choose,temp,z;ElemTypea,b,c;LNode*p1;printf(“\t\t\t款待进入学子的音信连串\n”);printf(“**************************************************************\n”);printf(“\t\t1.依照内定学子个数,输入学生消息\n”);printf(“\t\t2.各个显示表中持有学子的相干音信\n”);printf(“\t\t3.基于姓名实行搜寻,重回此学子的学号和成就\n”);printf(“\t\t4.依照钦命的地点再次回到相应的学员消息\n”);printf(“\t\t5.给定叁个学员音信,插入到表中钦命的地点\n”);printf(“\t\t6.删除钦命地点的学子记录\n”);printf(“\t\t7.总计表中学子个数\n”);printf(“\t\t8.运维甘休退出程序\n”);printf(“**************************************************************\n”卡塔尔;while(choose卡塔尔(قطر‎{printf(“请输入你的选用:\n”卡塔尔;scanf(“%d”,chooseState of Qatar;if(choose8卡塔尔printf(“输入错误!\n”);switch(choose){case1:printf(“\t\t1.依据钦定学子个数,输入学子音信\n”卡塔尔(قطر‎;printf(“请输入学子的食指:\n”);scanf(“%d”,m);printf(“\n”);if(CreateList_H(L,m卡塔尔State of Qatarprintf(“输入成功!\n”卡塔尔(قطر‎;printf(“输入退步!\n”);break;case2:printf(“\t\t2.各种突显表中具备学员的有关新闻\n”);for(k=0;km;*(++p1卡塔尔(قطر‎,k++卡塔尔{printf(“第%d个学子的音讯:”,k+1卡塔尔(قطر‎;printf(“学号:%s”,p1-data.num卡塔尔;printf(“名字:%s”,p1-data.name卡塔尔国;printf(“成绩:%.2f”,p1-data.scoreState of Qatar;}printf(“\n”);break;case3:printf(“\t\t3.基于姓名进行检索,再次来到此学子的学号和成就\n”卡塔尔国;printf(“请输入要物色的真名:”卡塔尔(قطر‎;scanf(“%s”,a.name卡塔尔;p1=LocateElem(L,a卡塔尔(قطر‎;printf(“学号:%s”,p1-data.num卡塔尔;printf(“成绩:%.2f\n”,p1-data.score);break;case4:printf(“\t\t4.依照钦赐的职位重回相应的学子消息\n”卡塔尔;printf(“请输入钦命之处:”State of Qatar;scanf(“%d”,xState of Qatar;temp=GetElem(L,x,b卡塔尔(قطر‎;if(temp卡塔尔国printf(“学号:%s,姓名:%s,成绩:%.2f\n”,b.num,b.name,b.score);break;case5:printf(“\t\t5.给定叁个学子音信,插入到表中内定的地点\n”卡塔尔;printf(“请输入要插入的位置:\n”卡塔尔国;scanf(“%d”,y卡塔尔(قطر‎;printf(“请输入要插入的音讯:\n”卡塔尔;printf(“学号:”卡塔尔;scanf(“%s”,c.num卡塔尔(قطر‎;printf(“姓名:”卡塔尔国;scanf(“%s”,c.name卡塔尔国;printf(“成绩:”卡塔尔国;scanf(“%d”,c.scoreState of Qatar;if(ListInsert(L,y,c卡塔尔国卡塔尔国{printf(“插入成功!\n”State of Qatar;++m;}elseprintf(“插入退步!\n”);break;case6:printf(“\t\t6.删除钦命地点的上学的小孩子记录\n”卡塔尔(قطر‎;printf(“请输入要去除的任务:”卡塔尔;scanf(“%d”,z卡塔尔(قطر‎;if(ListDelete(L,z卡塔尔(قطر‎State of Qatar{printf(“删除成功!\n”卡塔尔(قطر‎;–m;}printf(“删除失利!\n”);break;case7:printf(“\t\t7.总括表中学子个数\n”卡塔尔(قطر‎;printf(“总括后学子的个数为:%d\n”,m);break;case8:printf(“\t\t8.运行甘休退出程序\n”);printf(“\n退出系统成功!请按大肆键甘休!\n”);exit(0);break;}}}

void Passward(char str[]卡塔尔国   //登入密码
{
    char passward[LENTH]=”000000″;
    FILE *fp;

    while(1)
    {
        system(“CLS”);
        printf(“请输入新密码:”卡塔尔国;
        scanf(“%s”,newPassward);
        getchar();
        printf(“再次输入新密码:”State of Qatar;
        scanf(“%s”,temp);
        getchar();

    p=H->next;

int countNumber(int choose,books* H卡塔尔(قطر‎;   
//总括钦定小编或出版商或ISBN号形似的书籍数量
int checkISBN(char ISBN[]卡塔尔国;         
//检查实验ISBN的科学,对回到1,错的重临0
int checkNumbook(int num_book,books* H卡塔尔(قطر‎;       
//检查图书编号精确性,对回到1,错的重回0
int displayAllBookInfo(books* H卡塔尔(قطر‎;    //呈现任何图书信
int enterUI(char passWard[]卡塔尔(قطر‎;   //顾客登陆
books* createBookInfoSystem(卡塔尔国;       //数据存款和储蓄读取操作
books* createBookInfoByFile(FILE *fpState of Qatar ;        //文件读取数据
books* createBookInfo(卡塔尔(قطر‎;    
//用头、尾插法链表创制图书系统图书音讯,达到边排序边插入效果
void IU(卡塔尔;       //系统分界面设计
void SysLoad(卡塔尔;       //系统运维
void QueryBySpecialCondition(卡塔尔;     
//用于IU界面第八个成效模块的中间模块,查询钦定条件图书音信
void displayBookInfoByBook_number(int numbook,books* HState of Qatar;  
//依据图书编号突显图书新闻
void deleteBookInfo(books* HState of Qatar;       //依据图书编号删除图书音信
void modifiedByBook_number(books *HState of Qatar;     
//依照图书编号修改图书音信
void saveToFile(books *H卡塔尔(قطر‎;     //将数据保存至文件中
void addBookInfo(books* HState of Qatar;        //扩充图书新闻
void Passward(char str[]卡塔尔国 ;  //初步登入密码
void resetPassward(卡塔尔 ;  //校勘密码
void sortBySpacialCondition(卡塔尔;  //依据不一样口径实行排序
void sort(books *H,int sortType,char sortBy卡塔尔;  
//排序通用模块,sortType代表排序情势:1为升序,2为降序排序。sortBy为排序的基于

       while(p!=NULL)
       {
          if(p->numBook==bookNumber)
          {
             printf(“\n初阶更新书籍消息…\n\n”);
             printf(“请输入书名:”卡塔尔国;
             scanf(“%s”,p->name);
             printf(“请输入小编:”卡塔尔(قطر‎;
             scanf(“%s”,p->author);
             printf(“请输入书局:”卡塔尔国;
             scanf(“%s”,p->releaseOrg);
             printf(“请输入价钱:”卡塔尔;
             scanf(“%f”,&p->price);
             getchar();
             while(1)
             {
                printf(“请输入ISBN号:”);
                scanf(“%s”,p->ISBNnumber);
                getchar();
                if(checkISBN(p->ISBNnumber)==1)
                    break;
             }

    newBooks=(books*)malloc(sizeof(struct book));
    newBooks->next=NULL;

#include<stdio.h>
#include<string.h>
#include<stdlib.h>

            if(sortBy==’6′)
               while(s->next &&
p->numBook<s->next->numBook)
                  s=s->next;
            else if(sortBy==’7′)
               while(s->next &&
strcmp(p->releaseOrg,s->next->releaseOrg)<0)
                  s=s->next;
            else if(sortBy==’8′)
               while(s->next &&
strcmp(p->name,s->next->name)<0)
                  s=s->next;
            else if(sortBy==’9′)
               while(s->next &&
strcmp(p->author,s->next->author)<0)
                  s=s->next;
            else if(sortBy==’A’ || sortBy==’a’)
               while(s->next &&
abs(p->price-s->next->price)<0)
                  s=s->next;

books* createBookInfoSystem(卡塔尔(قطر‎     //数据存款和储蓄读取操作
{
    FILE *fp=NULL;
    if((fp=fopen(“bookInfo.txt”,”rt”卡塔尔(قطر‎卡塔尔国==NULLState of Qatar  
//即使数据文件存在,从文件读取 不然,手动创造
    {
        if((fp=fopen(“bookInfo.txt.txt”,”wt”))==NULL)
           exit(0);
        else
           return createBookInfo();
    }

    return head;
}

           case ‘6’:
               resetPassward();
               system(“CLS”);
              
printf(“\n密码已被涂改!请重新登入…\n系统退出…\n\n\n”);
               exit(0);

}

           case ‘4’:
               QueryBySpecialCondition();
               break;

 

    h=H;
    p=H->next;
    r=(books*)malloc(sizeof(struct book));
    r->next=NULL;

    while(p!=NULL)
    {
       
printf(“%d\t%s\t%s\t%s\t%.2f\t%s\n”,p->numBook,p->name,p->author,p->releaseOrg,p->price,p->ISBNnumber);
        p=p->next;
    }
    return 0;
}

        default:
          printf(“无切合查询的规格!”卡塔尔;
          return -1;
    }

      scanf(“%c”,&choose);
      getchar();
      switch (choose)
      {
          case ‘1’:
            sort(H,1,choose);
            break;

    system(“CLS”);
    printf(“最先增多的图书音信:\n\n\n”);

          case ‘5’:
            sort(H,1,choose);
            break;
          case ‘6’:
            sort(H,2,choose);
            break;

    if(ISBN[3]==’-‘ && ISBN[5]==’-‘ && ISBN[9]==’-‘ &&
ISBN[15]==’-‘)
    {
        for(;i<17;i++卡塔尔  //ISBN为17为字符(此中字符为数字和-)
        {
          if( i!=3 && i!=5 && i!=9 && i!=15 )
          {
             if( ISBN[i]<48 || ISBN[i]>57 )
               break;
          }
        }
        if(i==17)
          return 1;
     }
    printf(“ISBN格式错误!!!\n”);

void sort(books *H,int sortType,char sortBy卡塔尔(قطر‎  
//排序通用模块,sortType代表排序格局:1为升序,2为降序排序。sortBy为排序的凭借
{
    books *newBooks,*s,*p,*q;
//newBook用于存款和储蓄新的链表头,s指代遍历时当前线指挥部针

    if(sortType==2)
    {
        while(H->next)
        {
            p=(books *)malloc(sizeof(struct book));
            (*p)=*H->next;    //copy豆蔻梢头份当前线指挥部针
            p->next=NULL;
            s=newBooks;

void deleteBookInfo(books* H卡塔尔(قطر‎     //依据图书编号删除图书音信
{
    books *p,*pred,*r;   
//pred指针用来指明要删减的图书的前四个指南针
    int numbook;
    char ch;

          case ‘4’:
            sort(H,1,choose);
            break;

    system(“PAUSE”);
    saveToFile(head);

 

void displayBookInfoByBook_number(int numbook,books* HState of Qatar  
//遵照图书编号展现图书音信
{
    books *p;
    p=H->next;

           case ‘3’:
               system(“CLS”);
               printf(“该笔者的书本数量为:%d”,countNumber(2,H卡塔尔(قطر‎卡塔尔国;
               printf(“\n\n\n”);
               system(“PAUSE”);
               break;

books* createBookInfo(卡塔尔  
//用头、尾插法链表创造图书系统图书音信,到达边排序边插入效果
{
    struct book *head,*p,*r,*h,*q;   
//r为尾指针,h为头结点的指针,用于头插法.q用于循环遍历链表
    int state=1;

            if(sortBy==’1′)
            {
                newBooks=H;
                break;
            }
            else if(sortBy==’2′)
               while(s->next &&
strcmp(p->releaseOrg,s->next->releaseOrg)>0)
                  s=s->next;
            else if(sortBy==’3′)
               while(s->next &&
strcmp(p->name,s->next->name)>0)
                  s=s->next;
            else if(sortBy==’4′)
               while(s->next &&
strcmp(p->author,s->next->author)>0)
                  s=s->next;
            else if(sortBy==’5′)
               while(s->next &&
abs(p->price-s->next->price)>0)
                  s=s->next;

    while(p!=NULL)
    {
        if(p->numBook==num_book)
        {
            printf(“图书编号存在,输入错误!\n”);
            return 0;
        }
        p=p->next;
    }
    return 1;;
}

    while(1)
    {
        printf(“输入图书编号:”卡塔尔;
        scanf(“%d”,&(r->numBook));
        if(checkNumbook(r->numBook,H)!=0)
           break;
    }

    system(“CLS”);
    printf(“\n\t登入战败!系统退出!\n”);
    return 0;
}

        if(p->numBook==numbook)
        {
           
printf(“该号码图书信息:\n%s\t%s\t%s\t%s\t\t%.2f\n”,p->name,p->author,p->releaseOrg,p->ISBNnumber,p->price);
            printf(“确认删除?是(y卡塔尔国/否(n卡塔尔国: “State of Qatar;
            scanf(“%c”,&ch);
            getchar();

    printf(“请输入书名:”State of Qatar;
    scanf(“%s”,r->name);
    printf(“请输入作者:”卡塔尔;
    scanf(“%s”,r->author);
    printf(“请输入书局:”卡塔尔国;
    scanf(“%s”,r->releaseOrg);
    printf(“请输入价钱:”State of Qatar;
    scanf(“%f”,&(r->price));
    getchar();
    while(1)
    {
        printf(“请输入ISBN号:”);
        scanf(“%s”,r->ISBNnumber);
        getchar();
        if(checkISBN(r->ISBNnumber))
          break;
    }

               h=p;
               p=p->next;
            }

        fprintf(fp,”%s”,passward);
        printf(“暗中认可密码文件创建成功!”卡塔尔国;
        fclose(fp);
    }

books* createBookInfoByFile(FILE *fp卡塔尔国   //文件读取数据
{
    books *head,*p,*r,*h;   
//r为尾指针,h为头结点的指针,用于头插法
    head=(struct book *)malloc(sizeof(struct book));
    r=head;
    h=head;
    r->next=NULL;

void SysLoad(卡塔尔     //系统运维
{
    books* H=NULL;
    H=createBookInfoSystem();
    char choose;

#define N 50
#define LENTH 20

给要求谈论的友友小小参谋

          printf(“输入图书单价:”卡塔尔国;
          scanf(“%f”,&(p->price));
          getchar();

    return head;
}

int main()
{
    char passWard[LENTH];

    printf(“按默许的编号升序展现:\n\n”);
    while(p!=NULL)
    {
        if(p->numBook==numbook){
          
printf(“%s\t%s\t%s\t%s\t%.2f\n”,p->name,p->author,p->releaseOrg,p->ISBNnumber,p->price);
           return ;
        }
        p=p->next;
    }
    printf(“输入错误,该图书编号不设有!\n”);
}

            p->next=s->next;
            s->next=p;
            H=H->next;
        }
    }

           case ‘7’:
               sortBySpacialCondition();
               break;

发表评论

电子邮件地址不会被公开。 必填项已用*标注

网站地图xml地图