用VB编写三个数比较大小的程序

来源:百度知道 编辑:UC知道 时间:2024/06/22 08:36:25
任意输入三个整数A,B,C,请按从大到小的顺序排列。例如,A=5,B=2,C=7,则输出:C>A>B.

给你一个通用程序:
private sub form_load()
from1.autoredraw=true
endsub

private sub form_click()
dim Shu(3) as integer,Xu(3) as string,I as integer,J as integer
shu(1)=a:shu(2)=b:shu(3)=c
xu(1)="a":xu(2)="b":xu(3)="c"
for i=1 to 2
for J=I+1 to 3
if shu(i)<shu(j) then
shu(0)=shu(i):xu(0)=xu(i)
shu(i)=shu(j):xu(i)=xu(j)
shu(j)=shu(0):xu(j)=xu(0)
end if
next
next
xu(0)=""
for i=1 to 2
xu(0)=xu(0)+xu(i)
if shu(i)>shu(i+1) then
xu(0)=xu(0)+">"
else
xu(0)=xu(0)+"="
end if
xu(0)=xu(0)+xu(i)
print xu(0)
endsub

前面的废话就不写了,直接写主体

if A>B then
if c>a then
Return "A>B>C"
else
if c>b then
return "A>C>B"
else
return "A>B>C"
end if
end if
else