用一个同名函数对N个数据进行从大到小排序,数据可以是整型,单精,双精。用函数重载实现。#include <iostream>using namespace std;void sort(int* a, int n) { int t; int temp; for (int i=0; i<n-1; i++) { t=i; for (int j=i+1; j<n; j++) { if (*(a+t)>*(a+j)) t=j; } temp=*(a+i); *(a+i)=*(a+t); *(a+t)=temp; } } void sort(float* a, int n) { int t; float temp; for (int i=0; i<n-1; i++) { t=i; for (int j=i+1; j<n; j++) { if (*(a+t)>*(a+j)) t=j; } temp=*(a+i); *(a+i)=*(a+t); *(a+t)=temp; } } int main(){static int a[5]={5,4,96,87,54};static float b[5]={5.1,22.1,36.002,25.6,55.3};void sort(int);void sort(float);sort(a);sort(b);return 0;}调试出错:none of the 2 overloads can convert parameter 1 from type 'int [5]'none of the 2 overloads can convert parameter 1 from type 'float [5]'执行 cl.exe 时出错.