vbscript 三個(gè)數(shù)比較大小的實(shí)現(xiàn)代碼

字號(hào):


    代碼如下:
    dim a,b,c
    a =inputbox ("請(qǐng)輸入0-99的整數(shù)且不能重復(fù)更不要用漢字和字母")
    b =inputbox ("請(qǐng)輸入0-99的整數(shù)且不能重復(fù)更不要用漢字和字母")
    c =inputbox ("請(qǐng)輸入0-99的整數(shù)且不能重復(fù)更不要用漢字和字母")
    if not(IsNUmberic(a) and IsNUmberic(b) and IsNUmberic(c)) then
    msgbox "不乖哦>_<"
    else
    if a<b then
    d=b
    b=a
    a=d
    end if
    if c>b then
    d=b
    b=c
    c=a
    end if
    if a<b then
    d=b
    b=a
    a=d
    end if
    msgbox a & " " & b & " " & c
    end if
    由于樓主只是三個(gè)數(shù),所以不用復(fù)雜的冒泡排序法來排序,直接三個(gè)數(shù)比較就行了!tjoy7d的方法就是所謂的冒泡排序法,雖然代碼簡單,但是實(shí)際上電腦執(zhí)行起來要循規(guī)很多次,運(yùn)行速度會(huì)受到影響!