batman 当前离线
考官
荣誉版主
input = inputbox("请输入要排序的字符") Dim a, b, num, vbstr vbstr = " " For a=1 To Len(input) num = 0:b = 1 For b = 1 To a If Mid(input,a,1) >= Mid(vbstr,b,1) Then num = num+1 Next vbstr = Mid(vbstr,1,num) & Mid(input,a,1) & Mid (vbstr,num+1,Len(vbstr)-num) Next MsgBox "排序前:" & input & vbCrLf & "排序后:" & Mid(vbstr,2,Len(vbstr)) , 0 , "运算结果如下"复制代码
wc726842270 (枫中残雪)当前离线
大校
TOP
Dim input, num() input = InputBox ("请输入,注意将要排序的字符用空格格开:") ReDim num(Len (input)) Dim a, b:b = 0 For a = 1 To Len (input) flag = 0 If Mid (input, a, 1) <> " " And Mid (input, a, 1) <> " " Then num(b) = num(b) & Mid (input, a, 1) Else If flag = 0 Then b = b+1:flag = 1 End If Next Dim str():ReDim str(b) ReDim Preserve num(b):dim c, d:a = 1 For a = 0 To b c = 0:d = 0 For c = 0 To b If IsNumeric (num(a)) = True And IsNumeric (num(c)) = True Then If num(a) - num (c) > 0 Then d = d+1 Else If num(a) > num(c) Then d = d+1 End If Next If str(d) = "" Then str(d) = num(a) Else str(d) = str(d) & " " & num (a) End If Next Dim vbstr:d = 0 For d = 0 To b vbstr = vbstr & " " & str(d) Next MsgBox "排序前:" & input & vbCrLf & "排序后:" & right (vbstr, Len(vbstr)-1) , 0 , "运算结果"复制代码
Dim input, num() input = InputBox ("请输入,注意将要排序的字符用空格格开:") ReDim num(Len (input)) Dim a, b:b = 0 For a = 1 To Len (input) flag = 0 If Mid (input, a, 1) <> " " And Mid (input, a, 1) <> " " Then num(b) = num(b) & Mid (input, a, 1) Else If flag = 0 Then b = b+1:flag = 1 End If Next Dim str():ReDim str(b) ReDim Preserve num(b):dim c, d:a = 1 For a = 0 To b c = 0:d = 0 For c = 0 To b If IsNumeric (num(a)) = True And IsNumeric (num(c)) = True Then If num(a) - num (c) > 0 Then d = d+1 Else If num(a) > num(c) Then d = d+1 End If Next If str(d) = "" Then str(d) = num(a) Else str(d) = str(d) & " " & num (a) End If Next Dim vbstr:d = 0 For d = 0 To b vbstr = vbstr & " " & str(d) Next Set ie = WScript.CreateObject("internetexplorer.application") With ie .Navigate "about:blank" .Width = 400 .Height = 200 With .Document.parentwindow .moveto (.Screen.AvailWidth-400)/2,(.Screen.AvailHeight-200)/2 .Document.Write "<FONT face=楷体_GB2312 color=#FF9224 size=3><br>排序前:" & input & "<br>排序后:" & right(vbstr, len(vbstr)-1) & "</font></br><body bgcolor='#8020ff'></br>" .Document.title = "运算结果如下" End With .document.close .MenuBar = 0 .ToolBar = 0 .AddressBar = 0 .StatusBar = 0 .Visible = true .Resizable = 0 End With WScript.Sleep 10000 ie.Quit Set ie = nothing复制代码
评分人数