vb 将选择排序法和冒泡排序法分别改为通用过程

vb 将选择排序法和冒泡排序法分别改为通用过程

题目
vb 将选择排序法和冒泡排序法分别改为通用过程
答案
选择排序法
Private Sub Command1_Click()
Dim i As Integer, j As Integer, t As Integer, a(1 To 10) As Integer
Print "原始数据如下"
For i = 1 To 10
a(i) = Int(Rnd * 10)
Print a(i);
Next i
Print "按从小到大排列输出:"
For i = 1 To 9
For j = i + 1 To 10
If a(i) > a(j) Then t = a(i): a(i) = a(j): a(j) = t
Next j
Next i
For i = 1 To 10
Print a(i);
Next
End Sub
通用过程
Public Sub swap_1()
Print "按从小到大排列输出:"
For i = 1 To 9
For j = i + 1 To 10
If a(i) > a(j) Then t = a(i): a(i) = a(j): a(j) = t
Next j
Next i
For i = 1 To 10
Print a(i);
End Sub
举一反三
已知函数f(x)=x,g(x)=alnx,a∈R.若曲线y=f(x)与曲线y=g(x)相交,且在交点处有相同的切线,求a的值和该切线方程.
我想写一篇关于奥巴马的演讲的文章,写哪一篇好呢?为什么好
奥巴马演讲不用看稿子.为什么中国领导演讲要看?
想找英语初三上学期的首字母填空练习……
英语翻译
最新试题
热门考点

超级试练试题库

© 2017-2019 超级试练试题库,All Rights Reserved.