Dim X$ 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 i = 1 To n Input #1, X Call Ans(X) Next Close Close End End Sub
Sub Ans(a) Dim b b = 0 For i = 1 To Len(a) m = Mid(a, i, 1) If m >= 0 And m <= 9 Then b = b + 1 Next
Dim X$
回覆刪除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 i = 1 To n
Input #1, X
Call Ans(X)
Next
Close
Close
End
End Sub
Sub Ans(a)
Dim b
b = 0
For i = 1 To Len(a)
m = Mid(a, i, 1)
If m >= 0 And m <= 9 Then b = b + 1
Next
Print #2, b
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 i = 1 To n
Input #1, X
Print #2, c(X)
Next i
Close #2
Close #1
End
End Sub
Function c(A)
ans = 0
For i = 1 To Len(A)
M = Mid(A, i, 1)
If M >= "0" And M <= "9" Then ans = ans + 1
Next i
c = ans
End Function
佑好,arro好,
回覆刪除程式正確。