给你个程序你满意不?文件名请自己更换。
=============================
Dim z() As Single, a() As Single, i As Integer, j As Integer
Private Sub Command1_Click()
Open "d:\a.txt" For Input As 1
ReDim z(0), a(0)
Do While EOF(1) = False
ReDim Preserve z(i), a(i)
Dim s As String
Line Input #1, s
Dim t
t = Split(s, "A")
z(i) = Text4.Text - Mid(t(0), 2)
a(i) = t(1) * 3.141592 * Text3.Text / 360
i = i + 1
Loop
Close 1
Open "d:\b.txt" For Output As 2
For j = 0 To i - 1
Print z(j); a(j)
Write #2, "Z" & z(j) & "Y" & a(j)
Next
Close 2
End Sub
你认为哪里有问题??? 是计算不对,还是编译出错??
'只修改2个地方,其他不变 :
Private Sub Command1_Click()
Dim temp As String
Open Text1.Text For Input As #1
Open Text2.Text For Output As #2
Do While Not EOF(1)
Line Input #1, temp
Dim S As String, A
D = CDbl(Val(Text3.Text))
S = temp
A = Split(S, "A")
For i = 1 To UBound(A)
If Len(A(i)) > 0 Then
A(i)= D * 3.141592 / 360 * val(A(i)) '修改处
End If
Next
temp =join(a,"Y") '关键修改处
Print #2, temp
Loop
Close #1
Close #2
form4.Show
Unload Me
End Sub