设为首页 加入收藏

TOP

C语言实现线性存储之连续存储(二)
2014-11-23 21:27:34 来源: 作者: 【 】 浏览:13
Tags:语言 实现 线性 存储 连续
[i]; } array[pos-1] = num; } } void modify(int *array) { int pos = 0; int length = check_lenth(array); printf("Which place do you want to modify : "); while(scanf("%d",&pos) != 1 || pos < 1 || pos > length) { while(getchar() != '\n') ; printf("Wrong position!Please input again: \n"); } printf("Please input the number you want to change: "); while( scanf("%d",array+pos-1) != 1 ) { while(getchar() != '\n') ; printf("Invalid input!Please input again: \n"); } while(getchar() != '\n') ; } void delete(int *array) { int pos = 0,i; int length = check_lenth(array); if(length == 0) { printf("The length is 0,you can not delete!\n"); return; } printf("Which place do you want to delete : "); while(scanf("%d",&pos) != 1 || pos < 1 || pos > length) { while(getchar() != '\n') ; printf("Wrong position!Please input again: \n"); } while(getchar() != '\n') ; for(i=pos-1; i length ) { while(getchar() != '\n') ; printf("Invalid position!Please input again!\n"); } while(getchar() != '\n') ; printf("The positon %d you quary is : %d!\n",pos,array[pos-1]); } } } void show_array(int const *array) { int length = check_lenth(array); int i = 0; if(length == 0) { printf("The array is NULL!\n"); return; } else { for(i=0; i

最后,由于本人能力有限,其中肯定会有BUG,如果那位高人发现了,请及时给与评论指出啊!!谢谢啦!!!

首页 上一页 1 2 下一页 尾页 2/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇纯C语言写的日历 下一篇山东理工大学ACM平台题答案关于C..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: