好文档 - 专业文书写作范文服务资料分享网站

数据结构课程实验报告-CS1305-U201314927-韩晓阳资料

天下 分享 时间: 加入收藏 我要投稿 点赞

华中科技大学计算机 学院课程实验报告 }

else if(i==2&&L2.elem!=NULL) {

printf(\ Input which element you want find its prior: \

scanf(\ jud2=PriorElem(L2,a,&e2); if(jud2==1)

{printf(\ Find the prior, it is\\n\

else

printf(\ Not find it!\\n\

} else

printf(\not existed!\\n\

getchar();getchar(); break; }

case 9: {

printf(\ here is NextElem(),which being realized\\n\

printf(\L1 or L2(Input 1 or 2): \

scanf(\ while(i!=1&&i!=2) {

printf(\\

scanf(\ }

if(i==1&&L1.elem!=NULL) {

printf(\want find its next: \

scanf(\ jud1=NextElem(L1,a,&e1); if(jud1==1)

{printf(\the next, it is\\n\

else

printf(\find it!\\n\ }

13

华中科技大学计算机 学院课程实验报告 else if(i==2&&L2.elem!=NULL) {

printf(\ Input which element you want find its next: \

scanf(\ jud2=NextElem(L2,a,&e2); if(jud2==1)

{printf(\ Find the next, it is\\n\

else

printf(\ Not find it!\\n\

} else

printf(\not existed!\\n\

getchar();getchar(); break; }

case 10: {

printf(\ here is ListInsert(),which being realized\\n\ i=-1;

printf(\ Which list you want to insert?\\n L1 or L2(Input 1 or 2): \ scanf(\ while(i!=1&&i!=2) {

printf(\\

scanf(\ }

if(i==1&&L1.elem!=NULL) {

printf(\the element you want to insert: \

scanf(\

printf(\ Input the location you want to insert: \

scanf(\

jud1=ListInsert(&L1,i,a); if(jud1)

printf(\ Insert successfully!\\n\

14

华中科技大学计算机 学院课程实验报告 else

printf(\ }

else if(i==2&&L2.elem!=NULL) {

printf(\the element you want to insert: \

scanf(\

printf(\ Input the location you want to insert: \

scanf(\

jud2=ListInsert(&L2,i,a); if(jud2)

printf(\ Insert successfully!\\n\

else

printf(\ } else

printf(\not existed!\\n\

getchar();getchar(); break; }

case 11: {

printf(\ here is ListDelete(),which being realized\\n\ i=-1;

printf(\ Which list you want to delete?\\n L1 or L2(Input 1 or 2): \ scanf(\ while(i!=1&&i!=2) {

printf(\\

scanf(\ }

if(i==1&&L1.elem!=NULL) {

printf(\ Input the location you want to delete: \

scanf(\

jud1=ListDelete(&L1,i,&a); if(jud1)

15

华中科技大学计算机 学院课程实验报告 printf(\ Insert successfully! The element that was deleted is %d\\n\ else

printf(\ }

else if(i==2&&L2.elem!=NULL) {

printf(\ Input the location you want to insert: \

scanf(\

jud2=ListDelete(&L2,i,&a); if(jud2)

printf(\ Insert successfully! The element that was deleted is %d\\n\ else

printf(\ } else

printf(\not existed!\\n\

getchar();getchar(); break; }

case 12: {

printf(\ here is ListTrabverse(),which being realized\\n\

char tablename[9]; do{

printf(\table name[L1,L2]: \

scanf(\ }while(strcmp(tablename,\&& strcmp(tablename,\

if(!strcmp(tablename,\ if(!L1.elem)

printf(\does not exist!\\n\

else if(!ListTrabverse(L1,display))

printf(\ this liear table is empty!\\n\ }

16

华中科技大学计算机 学院课程实验报告 if(!strcmp(tablename,\ if(!L2.elem)

printf(\does not exist!\\n\

else if(!ListTrabverse(L2,display))

printf(\ this liear table is empty!\\n\ }

getchar();getchar(); break; } default: ; } }

while(op);

printf(\again!--------------------\\n\ SaveListToFile(&L1,&L2); getchar();getchar(); return 0; }

status InitList(SqList * L){

L->elem = (Elemtype *)malloc(LIST_INIT_SIZE*sizeof(Elemtype)); if(!L->elem)

return OVERFLOW; L->length=0;

L->listsize=LIST_INIT_SIZE; return OK; }

status DestroyList(SqList * L){ if(L->elem == NULL) return ERROR; else {

free(L->elem); L->elem = NULL; return OK; } }

17

数据结构课程实验报告-CS1305-U201314927-韩晓阳资料

华中科技大学计算机学院课程实验报告}elseif(i==2&&L2.elem!=NULL){
推荐度:
点击下载文档文档为doc格式
9ealq0d52t9lpyv23wwc1symv1joq10076i
领取福利

微信扫码领取福利

微信扫码分享