设计一个函数,实现一个一维数组的元素按大小降序排列,主程序中输入10个整数,要求降序显示

用C++
2024-12-25 23:36:22
推荐回答(1个)
回答1:

您好,编写一个函数可以实现任意长度整型数组的升序排序,最多10个元素。要求:1) int sort(int *a, int count) { int i,j,k; for(i=0;i
", i As Integer
Print "
For i = 1 To 10
a(i) = Int(Rnd * 100) + 1
Print a(i);随机生成数组: a(i) = temp
Next i
Next j
For i = 1 To 10
Print a(i);降序排序后为:" a(i + 1) Then temp = a(i + 1): a(i + 1) = a(i);
Next i
Print
Print "
Call px(a)
End Sub

Sub px(a() As Integer)
For j = 1 To 9
For i = 1 To 9
If a(i) <Private Sub Command1_Click()
Dim a(10) As Integer