有一浮点型数组A,用C语言写一函数实现对浮点数组A进行降序排序,并输出结果要求要以数组A作为函数的入口,请用冒泡和选择各写一遍
#include <stdio.h>
void maopao()
{int arr[5] = {10,11,15,13,20};int i=0,j=0,temp;int len = sizeof(arr)/sizeof(arr[0]);for(i=0;i<len;i++){for(j=0;j<len-i-1;j++){if(arr[j+1] > arr[j]){temp = arr[j];arr[j] = arr[j+1];arr[j+1] = temp;}}}for(i=0;i<len;i++){printf("%d ",arr[i]);}printf("\n");}
void xuanze()
{int arr[5] = {10,11,15,13,20};int i=0,j=0,temp,min;int len = sizeof(arr)/sizeof(arr[0]);for(i=0;i<len-1;i++){min = i;for(j=i+1;j<len;j++){if(arr[min] < arr[j]){min = j;}}temp = arr[i];arr[i] = arr[min];arr[min] = temp;}for(i=0;i<len;i++){printf("%d ",arr[i]);}printf("\n");}
int main(int argc, const char *argv[])
{maopao();xuanze();return 0;
}