用VB设计:从键盘输入任意5个整数,按由小到大的顺序打印这5个数?
展开全部
简单的比较啊
for i = 1 to 5
a[i]=inputbox....
for i = 1 to 4
for j= i+1 to 5
if a[i]>a[j] then
m=a[i]
a[i]=a[j]
a[j]=m
next
next
for i = 1 to 5
print a[i]
next
for i = 1 to 5
a[i]=inputbox....
for i = 1 to 4
for j= i+1 to 5
if a[i]>a[j] then
m=a[i]
a[i]=a[j]
a[j]=m
next
next
for i = 1 to 5
print a[i]
next
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
--
2022-12-05 广告
2022-12-05 广告
图形化编程简单理解为用积木块形式编程,scratch和python也是其中的一种,属于入门级编程,以其简单生动的画面获得无数学生的喜爱,深圳市创客火科技有限公司是一家做教育无人机的公司,旗下有编程无人机,积木无人机及室内外编队,每款飞机含有...
点击进入详情页
本回答由--提供
展开全部
Private Sub Command1_Click()
Cls
Dim yh(5) As Long
Dim p(5) As Long
For i = 1 To 5
Randomize
yh(i) = Int(Rnd() * 50) + 1
Next i
For m = 1 To 5
Print yh(m);
Next m
Print
xm = 1
For j = 1 To 5
For n = 1 To 5
If yh(j) > yh(n) Then xm = xm + 1
Next n
If p(xm) <> 0 Then xm = xm + 1
p(xm) = yh(j)
xm = 1
Next j
For r = 1 To 5
Print p(r);
Next r
End Sub
Cls
Dim yh(5) As Long
Dim p(5) As Long
For i = 1 To 5
Randomize
yh(i) = Int(Rnd() * 50) + 1
Next i
For m = 1 To 5
Print yh(m);
Next m
xm = 1
For j = 1 To 5
For n = 1 To 5
If yh(j) > yh(n) Then xm = xm + 1
Next n
If p(xm) <> 0 Then xm = xm + 1
p(xm) = yh(j)
xm = 1
Next j
For r = 1 To 5
Print p(r);
Next r
End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询