if a>b then
min=b
if min<c then
min=min
else
min=c
end if
max=a
if max>c then
max=max
else
max=c
end if
else
min=a
if min<c then
min=min
else
min=c
end if
max=b
if max>c then
max=max
else
max=c
end if
end if
l=max-min
response.write "max:"&max
response.write "min:"&min
response.write "kuaj:"&kuaj
response.end
%>
if ab>=0 and bc>=0 then
a是最大的
c是最小的
ab+bc是最大最小的差
elseif ab>=0 and bc<=0 then
if ab+bc>=0 then
a最大,b最小,ab是差
else
c最大,a最小,-bc是差
end if
elseif ab<0 and bc<0 then
c最大,a最小,-ab-bc是差
elseif ab<0 and bc>0 then
if ab+bc>=0 then
b最大,c最小,bc是差
else
b最大,a最小,-ab是差
end if
--------------------------
哈哈,好玩吧?
--------------------------
sub swap(byref a,byref b)
a=a+b
b=a-b
a=a-b
end sub
if a>b then swap a,b
if b>c then swap b,c
if a>b then swap a,b
LZ让我想起了第一次上C语言课时的情景,谭浩强教授出的那本,好像里面有一个差不多的例子
现在我用ASP来改写下,如果没记错的话:
<%
a=3
b=1
c=5
if a<b then
temp=a
a=b
b=temp
end if
if a<c then
temp=a
a=c
c=temp
end if
if b<c then
temp=b
b=c
c=temp
end if
Response.write "最大:"&a&"最小:"&c
Response.write "差:"&a-c
%>