帮忙做两个简单的VB程序

来源:百度知道 编辑:UC知道 时间:2024/05/02 01:47:15
一个是三个数字按大小顺序输出
还有一个是三个数字输出最大的一个
谢谢了!

1.
private sub X()
'将数字放在A数组中
'不管你有几个数都行,3的话就N=3
dim i as integer, j as integer, temp as integer
for i=1 to n step 1
for j=1 to n step 1
if a(i)<a(j) then
temp=a(i)
a(i)=a(j)
a(j)=temp
end if
next j
next i

for i=1 to n step 1
print(a(i))
next i
end sub

2.
private sub XX();
'同样将数字放在A数组中
'不管你有几个数都行,3的话就N=3
dim max as integer,i as integer

max=0
for i=1 to n step 1
if a(i)>max then max=a(i)
next
pritn max
end sub

private sub from1_load()
dim a as single
dim b as single
dim c as single
dim max as single
a = 写上你的第一个数
b = 写上你的第二个数
c = 写上你的第三个数
if a < b then
max = b
else max = a
end if

if max < c then
max = c