第一范文网 - 专业文章范例文档资料分享平台

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

来源:用户分享 时间:2025/8/7 13:25:39 本文由loading 分享 下载这篇文档手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xxxxxxx或QQ:xxxxxx 处理(尽可能给您提供完整文档),感谢您的支持与谅解。

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

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-韩晓阳资料.doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.diyifanwen.net/c9ealq0d52t9lpyv23wwc1symv1joq10076i_4.html(转载请注明文章来源)
热门推荐
Copyright © 2012-2023 第一范文网 版权所有 免责声明 | 联系我们
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:xxxxxx 邮箱:xxxxxx@qq.com
渝ICP备2023013149号
Top