主观

写出模板函数实现数值型数组元素值按从小到大排序的程序。

#include

using namespace std;

____________

void sort(Tb[ ],int n)

{T temp;

int i,j;

T*a=newT[n];

for(i=0;i

{a[i]=b[i];}

for(i=0;i

{for(j=i+;j

if(a[i]>a[j])

{temp=a[i];

a[i]=a[j];

a[j]=temp;

}

}

}

for(i=0;i

{cout<

cout<

delete a;

}

void main()

{int i,n=6;

int a[]={5,1,9,10,3,8}

sort___________;

for(i=0;i

{cout<

cout<

}

参考答案
您可能感兴趣的试题
¥

订单号:

遇到问题请联系在线客服

订单号:

遇到问题请联系在线客服