...int *a, int n ),对数组中的n个数降序排序编写main函数,并在其中...答:int *arr,int len){ for(int i = 0;i<len;i++){ printf("%d ",arr[i]);} printf("\n");} int main(){ int arr[] = {8,9,2,1,7,10,3,6,5,4};printf("排序前:\n");printArr(arr,10);printf("排序后:\n");sort(arr,10);printArr(arr,10);return 0;} ...
...个二位数组按每一个元素最后一个元素从小到大排序答:int dim2 );int swap(int *a, int *b);int qsort(int array[][2]);int main(){ int array[6][2] = {4, 9, 2, 6, 4, 5, 1, 2, 1, 7, 2, 4}; printf("排序前:\n"); printArray(array, 6, 2); qsort(array); printf("排序后:\n"); printArray(array,...
编写一个程序用选择法对数组a[]={20,10,50,40,30,70,60,80,90,100}进...答:4、往后比较,与最大的进行交换,使得a[i]是在i-n中最大;5、i++,调至2;6、结束,输出结果。参考代码:import java.util.Scanner;public class Main { private Scanner in = new Scanner(System.in);private int n, a[];private void input(){ n = in.nextInt();//输入数组个数 a=...