Private Sub Form_Load() Me.Hide Dim ans As Long 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 ans = 0 For j = 1 To Len(x) If Mid(x, j, 1) <= 9 And Mid(x, j, 1) >= 0 Then ans = ans + 1 Next Print #2, ans Next Close Close 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, n For i = 1 To n Sum = 0 Line Input #1, s For j = 1 To Len(s) If Mid(s, j, 1) >= 0 And Mid(s, j, 1) <= 9 Then Sum = Sum + 1 Next j Print #2, Sum Next i Close #2 Close #1 End End Sub
Dim a As String Private Sub Form_Load() Me.Hide Dim ans As Integer Open App.Path & "\in.txt" For Input As #1 Open App.Path & "\out.txt" For Output As #2 Input #1, x For j = 1 To Val(x) Line Input #1, y ans = 0 For i = 1 To Len(y) a = Mid(y, i, 1) If IsNumeric(a) Then ans = ans + 1 Next i Print #2, ans Next j Close #2 Close #1 End End Sub
Private Sub Form_Load()
回覆刪除Me.Hide
Dim ans As Long
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
ans = 0
For j = 1 To Len(x)
If Mid(x, j, 1) <= 9 And Mid(x, j, 1) >= 0 Then ans = ans + 1
Next
Print #2, ans
Next
Close
Close
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, n
For i = 1 To n
Sum = 0
Line Input #1, s
For j = 1 To Len(s)
If Mid(s, j, 1) >= 0 And Mid(s, j, 1) <= 9 Then Sum = Sum + 1
Next j
Print #2, Sum
Next i
Close #2
Close #1
End
End Sub
Dim a As String
回覆刪除Private Sub Form_Load()
Me.Hide
Dim ans As Integer
Open App.Path & "\in.txt" For Input As #1
Open App.Path & "\out.txt" For Output As #2
Input #1, x
For j = 1 To Val(x)
Line Input #1, y
ans = 0
For i = 1 To Len(y)
a = Mid(y, i, 1)
If IsNumeric(a) Then ans = ans + 1
Next i
Print #2, ans
Next j
Close #2
Close #1
End
End Sub