福建省计算机二级VB编程题
编程题
N = Val(Text1.Text)
Select Case N
Case 80 To 100
Text2.Text = "优良"
Case 60 To 79
Text2.Text = "合格"
Case 0 To 59
Text2.Text = "不合格"
End Select
Dim i%, s&
N = Val(Text1.Text)
s = 0
If i Mod 2 = 0 Then s = s + i
Next i
Text2.Text = Str(s)
Dim i As Integer
N = Val(Text1.Text)
Text2.Text = ""
For i = N To 1000
If i Mod 8 = 1 Then Text2.Text = Text2.Text & i & " " Next i
Dim i As Integer
s = 0
N = Val(Text1.Text)
s = s + i ^ i
Next i
Text2.Text = s
Dim i%, n%, a As String * 1
n = 0
For i = 1 To Len(Text1.Text)
a = Mid(Text1.Text, i, 1)
If a >= "0" And a <= "9" Then n = n + 1
Next i
Text2.Text = Str(n)
Dim a As Double, b As Double, c As Double '保留本行定义 a = Val(Text1.Text)
b = Val(Text2.Text)
c = Val(Text3.Text)
If b ^ 2 - 4 * a * c >= 0 Then Text4.Text = "实数解"
Else
Text4.Text = "复数解"
End If
N!
S=1
For i=1 to n
S=s*i
Next i
1+1!+2!+3!+。。。+n!
Dim i%, t&,n%,s&
n=val(text1.text)
t=1
s=1
For i=1 to n
s=s*i
t=t+1.0/s
Next i
Dim i As Integer, j As Integer, s As Long N = Val(Text1.Text)
Text2.Text = Str(e)
Dim N As Integer, s As Single '保留
Dim i%
N = Val(Text1.Text)
s = 0
s = s + (-1) ^ (i + 1) / i
Next i
Text2.Text = Str(s)
Dim i%
Text1.Text = ""
For i = 100 To 200
If i Mod 3 = 0 And i Mod 6 <> 0 Then Text1.Text = Text1.Text & i & " " Next i
Dim A(1 To 20) As Integer, i As Integer
Text1.Text = ""
Text2.Text = ""
Randomize
A(i) = Int(Rnd * 90 + 10)
Text1.Text = Text1.Text & A(i) & " "
Text2.Text = Text2.Text & IIf(A(i) >= 65 And A(i) <= 90, Chr(A(i)) & " ", "") Next i
Private Sub Command1_Click()
'不得删改本行注释
Randomize
Text1.Text = Int(Rnd * 9000 + 1000)
End Sub
Private Sub Command2_Click()
'不得删改本行注释
Dim i%, s%
s = 0
For i = 1 To Len(Text1.Text)
s = s + Val(Mid(Text1.Text, i, 1))
Next i
Text2.Text = Str(s)
End Sub
Private Sub Command1_Click()
'不得删改本行注释
Dim i As Integer
Text2.Text = ""
For i = 1 To Len(Text1.Text)
Text2.Text = Mid(Text1.Text, i, 1) & Text2.Text Next i
End Sub
Private Sub command1_click()
'''不得删改本行注释
Dim i%, chr As String * 1
Text3.Text = ""
For i = 1 To Len(Text1.Text)
chr = Mid(Text1.Text, i, 1)
If chr <> Text2.Text Then Text3.Text = Text3.Text & chr
'或者 If chr = Text2.Text Then Text3.Text = Replace(Text1.Text, chr, "") Next i
End Sub
Dim i%
Dim n%
n = Val(Text1.Text)
For i = 1 To n
Label2.Caption = Label2.Caption + Sjzf Next i
Function Sjzf() As String
Dim k As Integer
Randomize
k = Int(Rnd * 2)
If k = 0 Then
Sjzf = Chr$(Int(Rnd * 26) + 65)
Else
Sjzf = Chr$(Int(Rnd * 26) + 97)
End If
End Function