2008-05-22 11:48:31*~葉子~*

讀檔並排列(vb)

Private Sub Command1_Click()
Dim i As Integer
Dim j As Integer
Dim n As Integer

Open App.Path & ”1.txt” For Input As #1
Do
Input #1, n
For i = 1 To n
For j = 1 To i
Print j;
Next j
Print
Next i
Loop Until EOF(1)
Close #1
End Sub

Private Sub Command2_Click()
Dim i As Integer
Dim j As Integer
Dim n As Integer

Open App.Path & ”1.txt” For Input As #1
Do
Input #1, n
For i = n To 1 Step -1
For j = i To 1 Step -1
Print j;
Next j
Print
Next i
Loop Until EOF(1)
Close #1
End Sub