Private Sub Form_Load() Me.Hide Open App.Path & "\in.txt" For Input As #1 Open App.Path & "\out.txt" For Output As #2 Input #1, n For k = n - 1 To 0 Step -1 Print #2, Space(Int(k * 3)); For i = 1 To n - k Print #2, i; Next For j = n - k - 1 To 1 Step -1 Print #2, j; Next Print #2, Next For k = 1 To n - 1 Step 1 Print #2, Space(Int(k * 3)); For i = 1 To n - k Print #2, i; Next For j = n - k - 1 To 1 Step -1 Print #2, j; Next Print #2, Next Close #2 Close #1 End End Sub
Private Sub Form_Load() Me.Hide Open App.Path & "\in.txt" For Input As #1 Open App.Path & "\out.txt" For Output As #2 Input #1, x s = 0 For i = 1 To x s = s + 1 Print #2, Space((x - s) * 3); For k = 1 To i Print #2, k; Next For j = i - 1 To 1 Step -1 Print #2, j; Next Print #2, Next s = 0 For i = x - 1 To 1 Step -1 s = s + 1 Print #2, Space(s * 3); For k = 1 To i Print #2, k; Next For j = i - 1 To 1 Step -1 Print #2, j; Next Print #2, Next Close Close
Dim num As Integer
回覆刪除Dim ok(999) As String
Private Sub Form_Load()
Open App.Path & "\in.txt" For Input As #1
Input #1, num
Close #1
For i = 1 To num
For ai = 1 To i
ok(i) = ok(i) & ai
Next
If Not i - 1 = 0 Then
For ii = i - 1 To 1 Step -1
ok(i) = ok(i) & ii
Next
End If
For spacee = 1 To num - i
ok(i) = " " & ok(i)
Next
Open App.Path & "/out.txt" For Output As #1
For okk = 1 To num
Print #1, ok(okk)
Next
For okkk = num - 1 To 1 Step -1
Print #1, ok(okkk)
Next
Close #1
Next
End Sub
Private Sub Form_Load()
回覆刪除Me.Hide
Open App.Path & "\in.txt" For Input As #1
Open App.Path & "\out.txt" For Output As #2
Input #1, n
For k = n - 1 To 0 Step -1
Print #2, Space(Int(k * 3));
For i = 1 To n - k
Print #2, i;
Next
For j = n - k - 1 To 1 Step -1
Print #2, j;
Next
Print #2,
Next
For k = 1 To n - 1 Step 1
Print #2, Space(Int(k * 3));
For i = 1 To n - k
Print #2, i;
Next
For j = n - k - 1 To 1 Step -1
Print #2, j;
Next
Print #2,
Next
Close #2
Close #1
End
End Sub
Private Sub Form_Load()
回覆刪除Me.Hide
Open App.Path & "\in.txt" For Input As #1
Open App.Path & "\out.txt" For Output As #2
Input #1, x
s = 0
For i = 1 To x
s = s + 1
Print #2, Space((x - s) * 3);
For k = 1 To i
Print #2, k;
Next
For j = i - 1 To 1 Step -1
Print #2, j;
Next
Print #2,
Next
s = 0
For i = x - 1 To 1 Step -1
s = s + 1
Print #2, Space(s * 3);
For k = 1 To i
Print #2, k;
Next
For j = i - 1 To 1 Step -1
Print #2, j;
Next
Print #2,
Next
Close
Close