VB 帮我编写个小程序

来源:百度知道 编辑:UC知道 时间:2024/06/09 05:17:04
题目:编写程序,从键盘上输入5个数字,程序运行后从大到小的顺序输出
谢谢了

典型的数据排序问题,有好多排序方式,如果只是这5个数据无所谓,要是5万个数据排序就的考虑程序效率问题.建议去看数据结构中关于排序的讲解.
简单的如下:
dim NUMPX(5) as long
dim tempNum as long,temp as long
dim i,k as integer
for i=1 to 5
tempnum=inputbox "请输入第" & i & "个数字"
if i=1 then
numpx(0)=tempnum
else
for k=1 to 5
if tempnum>numpx(k) then
temp=temppx
temppx=numpx(k)
numpx(k)=temp
end if
next
end if
next

可以看看我对这到问题的回答

http://zhidao.baidu.com/question/96051281.html
你的要求比他的容易,数字是你自己输入的
把数组里的数换成你自己的输入就可以了