vb几道编程题,麻烦各位帮我解答一下
发布网友
发布时间:2023-12-11 07:40
我来回答
共3个回答
热心网友
时间:2024-12-14 11:02
第一题
Private Sub Command1_Click()
Dim s As Double
For i = 1 To Sqr(1 / (10 ^ -5))
s = s + 1 / (i * i)
Next i
Print s
End Sub
第二题
Option Base 1
Private Sub Command1_Click()
Dim a()
n = Len(Text1)
For i = 1 To n
x = Mid(Text1, i, 1)
If x = Chr(32) Then y = y + 1
Next i
Print "空格一共有:" & y & "个"
End Sub
第三题
Private Sub Command1_Click()
Dim a(10)
Randomize
x = 0
For i = 1 To 10
a(i) = Int(Rnd * 100)
If a(i) >= x Then x = a(i)
Print a(i)
Next i
Print "最大数为:"; x
End Sub
热心网友
时间:2024-12-14 11:02
第一题
i=1
Do Until 1/((i-1)*(i-1))<10^5
s=s+1/(i*i)
i=i+1
Loop
?s
第二题
For i=1 To Len(t$)
If Mid$(t$,I,1)=" " Then S=S+1
Next i
?s
第三题
Randomize Timer
Dim a(10)
For i=1 To 10
a(i)=Int(Rnd*100+1)
Next i
m=a(1)
For i=1 To 9
If a(i)<m Then a(i)=m
Next i
?m
热心网友
时间:2024-12-14 11:03
3我知道啊,就是RND~~随即数啊~