以下程序调用函数,用选择法对数组中的值按降序排序,请...

以下程序调用函数,用选择法对数组中的值按降序排序,请完成程序。 include <iostream> using namespace std; void sortd(,int n) { int i, j, p, t; for(i=0; i <n-1; i++) { ; for(j++) if(a[j]> a[p] ) p=j; if(p!=i) { t=a[i]; a[i]=a[p]; a[p]=t; } } } void main() { int a[10]; for(int i=0; i<10; i++) cin>>a[i]; sortd(a, 10); for(i=0; i<10; i++)> <<'\t'; }>

时间:2023-09-05 23:39:40

相似题目