《福建省计算机二级VB编程题(共8页).doc》由会员分享,可在线阅读,更多相关《福建省计算机二级VB编程题(共8页).doc(8页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、精选优质文档-倾情为你奉上编程题【1】 26-01N = 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【2】 25-01Dim i%, s& N = Val(Text1.Text) s = 0 For i = 1 To N If i Mod 2 = 0 Then s = s + i Next i Text2.Text = Str(s)【3】 24-01Dim i As Integ
2、er N = Val(Text1.Text) Text2.Text = For i = N To 1000 If i Mod 8 = 1 Then Text2.Text = Text2.Text & i & Next i【4】 23-01Dim i As Integer s = 0 N = Val(Text1.Text) For i = 1 To N s = s + i i Next i Text2.Text = s【5】 22-01Dim i%, n%, a As String * 1 n = 0 For i = 1 To Len(Text1.Text) a = Mid(Text1.Text
3、, i, 1) If a = 0 And a = 0 Then Text4.Text = 实数解 Else Text4.Text = 复数解 End If【7】 20-01N!S=1For i=1 to nS=s*iNext i1+1!+2!+3!+。+n!Dim i%, t&,n%,s&n=val(text1.text)t=1s=1For i=1 to ns=s*it=t+1.0/sNext iDim i As Integer, j As Integer, s As Long N = Val(Text1.Text) Text2.Text = Str(e)【8】 19-01Dim N As I
4、nteger, s As Single 保留 Dim i% N = Val(Text1.Text) s = 0 For i = 1 To N s = s + (-1) (i + 1) / i Next i Text2.Text = Str(s)【9】 18-01Dim 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【10】 17-01Dim A(1 To 20) As Integer, i As Integer Text1.Text
5、 = Text2.Text = Randomize For i = 1 To 20 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【11】 27-02Private Sub Command1_Click()不得删改本行注释 Randomize Text1.Text = Int(Rnd * 9000 + 1000)End SubPrivate Sub Command2_Cli
6、ck()不得删改本行注释 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【12】 23-02Private 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 iEnd Sub【13】 22
7、-02Private 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 iEnd Sub27-01Dim 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 IfEnd Function专心-专注-专业