在C盘当前文件夹下有一个已建立好的顺序文件Alph.txt,文件内容为只含有字母的一个字符串(有双引号界定符)。单击窗体,打开Alph.txt文件,读取字符串并显示在文本框Text1中,然后调用StrSort过程将此字符串按ASCII码的顺序重新排列并显示在文本框Text2中,最后将重新排列的字符串存入AlpO.txt文件中(无双引号界定符)。请选择横线处合适的语句( )。Private Sub Form_Load()Dim StrIn As String,StrOut As StringsOpen"C:\Alph.txt"For Input As #1______CloseText1.Text=StrIn______Text2.Text=StrOutOpen"C:\AlpO.txt"For Output As#2______CloseEnd SubPrivate Function StrSort(s As String)As StringDim s Arr() As String *1,i As Integer,j As Integer,n As IntegerDim t As String *1n=Len(s)ReDim sArr(n)For i=1 To ns Arr(i)=Mid(s,i,1)Next iFor i=1 To n-1For j=i+1 To nIf sArr(i)>sArr(j) Thent=sArr(i):sArr(j):sArr(j):sArr(j)=tEnd IfNext j,iFor i=1 To nStrSort=StrSort s Arr(i)Next iEnd FunctionA.Input#1,StrIn StrIn Print#2,StrOutB.Input#1,StrIn StrSort(StrIn) Input#2,StrOutC.Input#2,StrIn StrSort(StrIn) Input#1,StrOutD.Print#1,StrIn StrSort(StrIn) Input#2,StrOut
在C盘当前文件夹下有一个已建立好的顺序文件Alph.txt,文件内容为只含有字母的一个字符串(有双引号界定符)。单击窗体,打开Alph.txt文件,读取字符串并显示在文本框Text1中,然后调用StrSort过程将此字符串按ASCII码的顺序重新排列并显示在文本框Text2中,最后将重新排列的字符串存入AlpO.txt文件中(无双引号界定符)。请选择横线处合适的语句( )。
Private Sub Form_Load()
Dim StrIn As String,StrOut As Strings
Open"C:\Alph.txt"For Input As #1
______
Close
Text1.Text=StrIn
______
Text2.Text=StrOut
Open"C:\AlpO.txt"For Output As#2
______
Close
End Sub
Private Function StrSort(s As String)As String
Dim s Arr() As String *1,i As Integer,j As Integer,n As Integer
Dim t As String *1
n=Len(s)
ReDim sArr(n)
For i=1 To n
s Arr(i)=Mid(s,i,1)
Next i
For i=1 To n-1
For j=i+1 To n
If sArr(i)>sArr(j) Then
t=sArr(i):sArr(j):sArr(j):sArr(j)=t
End If
Next j,i
For i=1 To n
StrSort=StrSort & s Arr(i)
Next i
End Function
A.Input#1,StrIn StrIn Print#2,StrOut
B.Input#1,StrIn StrSort(StrIn) Input#2,StrOut
C.Input#2,StrIn StrSort(StrIn) Input#1,StrOut
D.Print#1,StrIn StrSort(StrIn) Input#2,StrOut