|
[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,如果那位高人发现了,请及时给与评论指出啊!!谢谢啦!!!
|