已阅读5页,还剩30页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
#include#include#includetypedef struct protect char quhao7; char bianhao5; char yanghuren20; char riqi11; char cuosi20; char zuangkuang20; struct protect *prot_next;prot;typedef struct gushumingmu char quhao7; char bianhao5; char name20; char xueming20; char kesu20; int shuling; char querensijian11; char baohujibie; char zaizididian30; struct protect *prot_head; struct gushumingmu *gusm_next;gusm;typedef struct chengquxinxi char quhao7; char quming20; char bumen30; char dizi30; char dianhua13; char fuzeren20; struct gushumingmu *gusm_head; struct chengquxinxi *chex_next;chex;chex *chex_head;void create_cross_list(chex *);void create_gusm(gusm *,chex *);void create_prot(prot *prot_head,gusm *p_gusm);int load_cross_list(chex *chex_head);int save_cross_list(chex *chex_head);void trav_chex(void);void trav_gusm(gusm *);void trav_prot(prot *);void traverse_cross_list(chex *chex_head);void edit_cross_list(void);void count_cross_list(chex *chex_head);void modf_chex(chex *chex_head);void modf_gusm(chex *p);void modf_prot(chex *p);void delt_chex(chex *p);void delt_gusm(chex *p);void delt_prot(chex *p);void inst_chex(chex *p);void inst_gusm(chex *p);void inst_prot(chex *p);void count(void);int levl_qcot(char *,char);int zhuk_qcot(char *,char *);int kind_qcot(char *,char *);void one_levl_cout(void);void one_zhuk_cout(void);void one_kind_cout(chex *P);void totl_levl_cout(chex *p);void totl_zhuk_cout(void);void totl_kind_cout(chex *p);void one_shul_cout(void);void totl_shul_cout(void);int shul_qcot(char *,int);main() char ch,ch1;printf( * n * * * * *n * * * * * *n * * * * * * *n * * * * * * * n * * * * *nn * * * * *n * * * * * * * *n * * * * * * * *n * * * * * * *n * * * * *nn); do printf( *n * 1:input and creat the cross list. *n * *n * 2:save the cross list. *n * *n * 3:load the cross list. *n * *n * 4:traverse the cross list. *n * *n * 5:edit the cross list *n * *n * 6:count and sort the cross list *n * *n * 7:quit this program *n *n); do printf(nttplease make a choice,(1-7)n); ch=getchar(); fflush(stdin); while(ch7); switch(ch) case 1:create_cross_list(&chex_head);break; case 2:save_cross_list(chex_head);break; case 3:load_cross_list(&chex_head);break; case 4:traverse_cross_list(chex_head);break; case 5:edit_cross_list();break; case 6:count();break; case 7: printf(tare you sure you have saved all the data and quit it?n); ch1=getchar(); fflush(stdin); if(ch1=y|ch1=Y) exit(-1); fflush(stdin); printf(tContinue make a choice?yes or no?n); ch=getchar(); fflush(stdin); while( ch=y|ch=Y);void create_cross_list(chex *chex_head) chex *hp=NULL,*p_chex; char ch; loop: /*create chengqujinbenxinxi*/ p_chex=(chex *)malloc(sizeof(chex); printf(tPlease input information of the area:ntzip_code area_name department address phone charman:n); scanf(%s%s%s%s%s%s,p_chex-quhao,p_chex-quming,p_chex-bumen,p_chex-dizi,p_chex-dianhua,p_chex-fuzeren); fflush(stdin); p_chex-gusm_head=NULL; p_chex-chex_next=hp; hp=p_chex; printf(tContinue input information of the the area?yes or no?n); ch=getchar(); fflush(stdin); if(ch=y|ch=Y) goto loop; (*chex_head)=hp; while(p_chex!=NULL) /*create information of ancient trees*/ printf(tCreate %ss ancient trees list?yes or no?n,p_chex-quming); ch=getchar(); fflush(stdin); if(ch=y|ch=Y) create_gusm(&p_chex-gusm_head,p_chex); p_chex=p_chex-chex_next; void create_gusm(gusm *gusm_head,chex *p_chex) gusm *hp=NULL,*p_gusm; char ch; loop: /*create gusm*/ p_gusm=(gusm *)malloc(sizeof(gusm); printf(tPlease input %s new ancient trees information: ntsequence name science_name generic age confirm_time protect_level lacation:n,p_chex-quming); scanf(%s%s%s%s%d%s%1s%s,p_gusm-bianhao,p_gusm-name,p_gusm-xueming,p_gusm-kesu,&p_gusm-shuling,p_gusm-querensijian,&p_gusm-baohujibie,p_gusm-zaizididian); fflush(stdin); strcpy(p_gusm-quhao,p_chex-quhao); p_gusm-prot_head=NULL; p_gusm-gusm_next=hp; hp=p_gusm; printf(tContinue add ancient trees to %s?yes or no?n,p_chex-quming); ch=getchar(); fflush(stdin); if(ch=y|ch=Y) /*create prot*/ goto loop; (*gusm_head)=hp; while(p_gusm!=NULL) printf(tCreate %ss %ss protection history?yes or no?n,p_gusm-zaizididian,p_gusm-name);ch=getchar();fflush(stdin); if(ch=y|ch=Y)create_prot(&p_gusm-prot_head,p_gusm);p_gusm=p_gusm-gusm_next;void create_prot(prot *prot_head,gusm *p_gusm) prot *hp=NULL,*p_prot; char ch; loop: /*create gushuyanghuxinxi*/ p_prot=(prot *)malloc(sizeof(prot); printf(tPlease input the informatione of the new protection history :ntguardian nurse_time(1991-03-25) measures health_conditionn); scanf(%s%s%s%s,p_prot-yanghuren,p_prot-riqi,p_prot-cuosi,p_prot-zuangkuang); fflush(stdin); strcpy(p_prot-quhao,p_gusm-quhao); strcpy(p_prot-bianhao,p_gusm-bianhao); p_prot-prot_next=hp; hp=p_prot;printf(tContinue input this %s protection history?yes or no?n,p_gusm-name); ch=getchar();fflush(stdin);if(ch=y|ch=Y) goto loop;(*prot_head)=hp;void trav_chex(void)chex *p_chex=chex_head; printf(*n);while(p_chex)printf(t%-7s%-11s%-17s%-14s%-12s%-6sn,p_chex-quhao,p_chex-quming,p_chex-bumen,p_chex-dizi,p_chex-dianhua,p_chex-fuzeren);p_chex=p_chex-chex_next;printf(_n);void trav_gusm(gusm *p_gusm) printf(_n);while(p_gusm) printf(t%-12s%-20s%-20s%-15sntt %-8d%-15s%-5c%sn,p_gusm-bianhao,p_gusm-name,p_gusm-xueming,p_gusm-kesu,p_gusm-shuling,p_gusm-querensijian,p_gusm-baohujibie,p_gusm-zaizididian);p_gusm=p_gusm-gusm_next;printf(_n);void trav_prot(prot *p_prot) printf(_n);while(p_prot) printf(t%-8s%-7s%-11s%-14s%-15s%-15sn,p_prot-quhao,p_prot-bianhao,p_prot-yanghuren,p_prot-riqi,p_prot-cuosi,p_prot-zuangkuang); p_prot=p_prot-prot_next; printf(-n); void traverse_cross_list(chex *chex_head) chex *p_chex=chex_head; gusm *p_gusm=NULL; prot *p_prot=NULL; printf(*n); while(p_chex!=NULL) /*print out chengquxinxi*/ printf(the information or the area is:n%-10s%-15s%-15s%-12s%-15s%-18sn,p_chex-quhao,p_chex-quming,p_chex-bumen,p_chex-dizi,p_chex-dianhua,p_chex-fuzeren); p_gusm=p_chex-gusm_head; while(p_gusm!=NULL) /*printf out information of ancient trees*/ printf(-n); printf(%ss ancient trees information:n%-10s%-10s%-20s%-20s%-15snt %-10d%-20s%-20c%-30sn,p_chex-quming,p_gusm-quhao,p_gusm-bianhao,p_gusm-name,p_gusm-xueming,p_gusm-kesu,p_gusm-shuling,p_gusm-querensijian,p_gusm-baohujibie,p_gusm-zaizididian); p_prot=p_gusm-prot_head; while(p_prot!=NULL) /*printf out gushumingmuyanghuxinxi*/ printf(_n); printf(the protection history of this ancient tree:n%-8s%-7s%-15s%-12s%-15s%-15sn,p_prot-quhao,p_prot-bianhao,p_prot-yanghuren,p_prot-riqi,p_prot-cuosi,p_prot-zuangkuang); p_prot=p_prot-prot_next; p_gusm=p_gusm-gusm_next; printf(*n); p_chex=p_chex-chex_next; int save_cross_list(chex *chex_head) FILE *out1,*out2,*out3; chex *p_chex=chex_head; gusm *p_gusm=NULL; prot *p_prot=NULL; if(out1=fopen(e:chex.dat,wb)=NULL) /*open out1*/ printf(tCant create a fill to save information of area.n); return(0); else printf(tCreate fill chex.dat successfully!n); if(out2=fopen(e:gusm.dat,wb)=NULL) /*open ou2*/ printf(tCant create a fill to save information of ancient trees.n); return (0); else printf(tCreate fill gusm.dat successfully!n); if(out3=fopen(e:prot.dat,wb)=NULL) /*open ou3*/ printf(tCant create a fill to save information of protection.n); return (0); else printf(tCreate fill prot.dat successfully!n); while(p_chex!=NULL) /*save in */ fwrite(p_chex,sizeof(chex),1,out1); p_gusm=p_chex-gusm_head; while(p_gusm!=NULL) fwrite(p_gusm,sizeof(gusm),1,out2); p_prot=p_gusm-prot_head; while(p_prot!=NULL) fwrite(p_prot,sizeof(prot),1,out3); p_prot=p_prot-prot_next; p_gusm=p_gusm-gusm_next; p_chex=p_chex-chex_next; fclose(out1); fclose(out2); fclose(out3); printf(t congrantulations! successfully saved!n); return (-1);int load_cross_list(chex *chex_head) FILE *in1,*in2,*in3; chex *hp_chex=NULL,*p_chex;gusm *hp_gusm=NULL,*p_gusm; prot *p_prot; if(in1=fopen(e:chex.dat,rb)=NULL) /*open in1*/printf(tFail to open fill chex.dat.ntpress any key to come back. n);getchar();return(0);printf(topen fill chex.dat successfully!n); if(in2=fopen(e:gusm.dat,rb)=NULL) /*open in2*/printf(tFail t open fill gusm.dat.ntpress any key to come backn);getchar();return(0);printf(topen fill gusm.dat successfully!n);if(in3=fopen(e:prot.dat,rb)=NULL) /*open in3*/printf(tFail to open fill prot.dat.ntpress any key to came backn);getchar();return(0); printf(topen fill prot.dat successfully!n); while(!feof(in1) /*load chex*/ p_chex=(chex *)malloc(sizeof(chex); fread(p_chex,sizeof(chex),1,in1); if(!feof(in1)p_chex-gusm_head=NULL;p_chex-chex_next=hp_chex; hp_chex=p_chex; (*chex_head)=hp_chex; while(!feof(in2) /*load gusm*/ p_gusm=(gusm *)malloc(sizeof(gusm); fread(p_gusm,sizeof(gusm),1,in2); if(!feof(in2) p_chex=(*chex_head); while(p_chex!=NULL) if(!strcmp(p_chex-quhao,p_gusm-quhao) p_gusm-prot_head=NULL; p_gusm-gusm_next=p_chex-gusm_head; p_chex-gusm_head=p_gusm; break; else p_chex=p_chex-chex_next; while(!feof(in3) /*load prot*/p_prot=(prot *)malloc(sizeof(prot);fread(p_prot,sizeof(prot),1,in3);if(!feof(in3)p_chex=(*chex_head);while(p_chex!=NULL)if(!strcmp(p_chex-quhao,p_prot-quhao)p_gusm=p_chex-gusm_head;while(p_gusm!=NULL) if(!strcmp(p_gusm-bianhao,p_prot-bianhao) p_prot-prot_next=p_gusm-prot_head; p_gusm-prot_head=p_prot; break;elsep_gusm=p_gusm-gusm_next;break;elsep_chex=p_chex-chex_next; fclose(in1); fclose(in2);fclose(in3);printf(tload succed!n);return 1;void edit_cross_list(void)char ch;printf(tt1:modifyn tt2:deleten tt3:insertn);doprintf(tplease make a choice:n);ch=getchar(); fflush(stdin);while(ch3);switch(ch) case 1:doprintf(tt1:modify information of area.n tt2:modify information of ancient trees.n tt3:modify information of protection.n); do printf(tplease make a choice:n); ch=getchar(); fflush(stdin); while(ch3); switch(ch) case 1:modf_chex(&chex_head);break; case 2:modf_gusm(&chex_head);break; case 3:modf_prot(&chex_head);break; printf(tlifft back up one level to the previous menu,yes or no?n); ch=getchar(); fflush(stdin);while(ch=y|ch=Y); break;case 2:doprintf(tt1:delete information of area.n tt2:delete information of ancient tree.n tt3:delete information of protection.n); do printf(tplease make a choice:n); ch=getchar(); fflush(stdin); while(ch3); switch(ch) case 1:delt_chex(&chex_head);break; case 2:delt_gusm(&chex_head);break; case 3:delt_prot(&chex_head);break; printf(tlifft back up one level to the previous menu,yes or no?n); ch=getchar(); fflush(stdin);while(ch=y|ch=Y);break;case 3:do printf(tt1:insert information of area.n tt2:insert information of ancient trees.n tt3:insert information of protection.n); do printf(tplease make a choice:n); ch=getchar(); fflush(stdin); while(ch3); switch(ch) case 1:inst_chex(&chex_head);break; case 2:inst_gusm(&chex_head);break; case 3:inst_prot(&chex_head);break; printf(tlifft back up one level to the previous menu,yes or no?n); ch=getcha
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 六常培训课件
- 大学生消费心理和行为特点专家讲座
- 背部养生培训课件模板
- 无锡培训教学课件
- 无证无照培训
- 护理学生人文素养提升方案
- 维修电工培训课件下载
- 2026年汽车美容服务培训
- 2026年老年人关怀服务提升策略
- 2026年会展行业运营培训
- 2025年国家开放大学《管理学基础》期末机考题库附答案
- 2025年人民网河南频道招聘备考题库参考答案详解
- ESHRE子宫内膜异位症的诊断与治疗指南(2025年)
- 2025核电行业市场深度调研及发展趋势与商业化前景分析报告
- 急惊风中医护理查房
- 营地合作分成协议书
- GB/T 70.2-2025紧固件内六角螺钉第2部分:降低承载能力内六角平圆头螺钉
- 基于视频图像的大型户外场景三维重建算法:挑战、创新与实践
- 物流管理毕业论文范文-物流管理毕业论文【可编辑全文】
- 2025年四川省高职单招模拟试题语数外全科及答案
- 2025年江苏事业单位教师招聘体育学科专业知识考试试卷含答案
评论
0/150
提交评论