10 T = 0: S = 0
20 READ X
30 If X = 0 Then GoTo 80
40 If X > 0 Then T = T + X Else S = S + X
50 GoTo 20
60 Data 1023, -575, -329, 984, 127, -98, 352
70 Data -603, -25, -85, 424, 359, 568, 0
80 Print "t="; T, "S="; S, "t+s="; T = S
End Sub
初学VB也没人教看的书上的,这段是:
10 T = 0: S = 0
20 READ X
30 If X = 0 Then GoTo 80
40 If X > 0 Then T = T + X Else S = S + X
50 GoTo 20
60 Data 1023, -575, -329, 984, 127, -98, 352
70 Data -603, -25, -85, 424, 359, 568, 0
80 Print "t="; T, "S="; S, "t+s="; T = S