计算机类二级VB

二级VB上机题库32

10 题含答案VB
共 10 题返回本类
2材料分析题2 / 10
  
查看答案
Private Sub Command1_Click()
  Label1.FontSize = Label1.FontSize + 2
'或  Label1.Font.Size = Label1.FontSize + 2
'或  Label1.FontSize = Label1.Font.Size + 2
'或  Label1.Font.Size = Label1.Font.Size + 2
'或  Label1.FontSize = 2 + Label1.FontSize
'或  Label1.Font.Size = 2 + Label1.FontSize
'或  Label1.FontSize = 2 + Label1.Font.Size
'或  Label1.Font.Size = 2 + Label1.Font.Size
End Sub
Private Sub Command2_Click()
  Label1.FontSize = 12
'或  Label1.Font.Size = 12
End Sub
3材料分析题3 / 10
   
Private Sub Cmd_Click(Index As Integer)
'    Select Case  ?
      Case 0
'          Timer1.Enabled =  ?
          Cmd(1).Enabled = True
          If Cmd(0).Caption = "开始" Then
              Cmd(0).Caption = "继续"
          End If
'          Cmd(0).Enabled =  ?
      Case 1
          Timer1.Enabled = False
          Cmd(0).Enabled = True
          Cmd(1).Enabled = False
      Case 2
          End
    End Select
End Sub
Private Sub Timer1_Timer()
    t(3) = t(3) + 1
'    If t(3) =  ?  Then
        t(3) = 0
        t(2) = t(2) + 1
        If t(2) = 60 Then
          t(2) = 0
          t(1) = t(1) + 1
        End If
    End If
    For i = 1 To 3
'        Text(  ?  ).Text = t(i)
    Next
End Sub
查看答案
    Select Case Index
          Timer1.Enabled = True
          Cmd(0).Enabled = False
    If t(3) = 60 Then
        Text(i - 1).Text = t(i)
4材料分析题4 / 10
   
Private Sub Command1_Click()
    Open App.Path & "\in4.dat" For Input As #1
    For i = 1 To 20
      For j = 1 To 5
          Input #1, a(i, j)
          Text1 = Text1 + Str(a(i, j)) + Space(2)
      Next j
    Next i
    Close #1
End Sub
Private Sub Command2_Click()
'考生编写
==================
???
==================
End Sub
Private Sub Form_Unload(Cancel As Integer)
    Open App.Path & "\out4.dat" For Output As #1
    Print #1, Text2.Text
    Close #1
End Sub
查看答案
  If Len(Text1) = 0 Then
      MsgBox "请先执行“读数据”功能!"
  Else
      For i = 1 To 20
        Max = a(i, 1)
        For j = 2 To 5
            If a(i, j) > Max Then Max = a(i, j)
        Next j
        s = s + Max
      Next i
      Avg = s / 20
      Text2 = Avg
  End If
5材料分析题5 / 10
   
Private Sub Command1_Click()
  Open App.Path & "\in5.dat" For Input As #1
  s = Input(LOF(1), #1)
  Close #1
  Text1.Text = s
End Sub
Private Sub Command2_Click()
'  If Len(s) =  ?  Then
      MsgBox "请先使用“读数据”功能!"
  Else
      t = ""
      For i = 1 To Len(s)
        c = Mid(s, i, 1)
'        If  ?  <> " " Then
          t = t + c
        Else
'          ?  = LCase(t)
          If InStr(x, "t") <> 0 And InStr(x, "h") <> 0 And InStr(x, "e") <> 0 Then
'              m =  ?
          End If
          t = ""
        End If
      Next i
      Text2.Text = m
  End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
    Open App.Path & "\out5.dat" For Output As #1
    Print #1, Text2.Text
    Close #1
End Sub
查看答案
Private Sub Command1_Click()
  Open App.Path & "\in5.dat" For Input As #1
  s = Input(LOF(1), #1)
  Close #1
  Text1.Text = s
End Sub
Private Sub Command2_Click()
  If Len(s) = 0 Then
      MsgBox "请先使用“读数据”功能!"
  Else
      t = ""
      For i = 1 To Len(s)
        c = Mid(s, i, 1)
        If c <> " " Then
          t = t + c
        Else
          x = LCase(t)
          If InStr(x, "t") <> 0 And InStr(x, "h") <> 0 And InStr(x, "e") <> 0 Then
              m = m + 1
          End If
          t = ""
        End If
      Next i
      Text2.Text = m
  End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
    Open App.Path & "\out5.dat" For Output As #1
    Print #1, Text2.Text
    Close #1
End Sub
7材料分析题7 / 10
  
查看答案
Private Sub Command1_Click()
  Text1.Alignment = 0
End Sub
Private Sub Command2_Click()
  Text1.Alignment = 2
End Sub
Private Sub Command3_Click()
  Text1.Alignment = 1
End Sub
8材料分析题8 / 10
   
Private Sub Command1_Click()
'  Text1.Enabled =  ?
  Text1.SetFocus
End Sub
Private Sub Command2_Click()
  If Text1.Enabled = False Then
      MsgBox "请先使用“输入密码”功能!"
  Else
'      If Text1 <>    "?"  Then
          n = n + 1
'          If  ?  = 3 Then
              MsgBox "三次密码输入错误,你无权进入本系统!"
              End
          Else
              MsgBox "第" + Str(n) + "次密码输入错误,请重试!"
              Text1 = ""
              Text1.SetFocus
          End If
        Else
          Text1.Enabled = False
          Text1 = ""
'          ?.Hide
'          ?.Show
        End If
  End If
End Sub
Private Sub Command1_Click()
  Form2.Hide
  Form1.Show
End Sub
查看答案
  Text1.Enabled = True
      If Text1 <> "abc" Then
'          If n = 3 Then 或          If n >= 3 Then
          Form1.Hide
          Form2.Show
9材料分析题9 / 10
   
Private Sub Command1_Click()
  Open App.Path & "\in4.dat" For Input As #1
  s = Input(LOF(1), #1)
  Close #1
  Text1.Text = s
End Sub
Private Sub Command2_Click()
  Dim m As Integer
'  If Len(s) =  ?    Then
    MsgBox "请先使用“读数据”功能!"
  Else
'    If Text1.?    = 0 Then
        MsgBox "请先选中文本!"
    Else
        t = ""
        For i = 1 To Text1.SelLength
          c = Mid(Text1.SelText, i, 1)
          If c <> " " Then
              t = t + c
          Else
'              If  ?  = "the" Then
                m = m + 1
              End If
              t = ""
          End If
        Next i
'        ?  = Str(m)
    End If
  End If
End Sub
查看答案
  If Len(s) = 0 Then
    If Text1.SelLength = 0 Then
              If LCase(t) = "the" Then
        Text2.Text = Str(m)
10材料分析题10 / 10
   
Private Sub Command1_Click()
    Dim k As Integer
    Open App.Path & "\in5.dat" For Input As #1
    For k = 1 To 100
        Input #1, a(k)
        Text1 = Text1 + Str(a(k)) + Space(1)
    Next k
    Close #1
End Sub
Private Sub Command2_Click()
  Dim b(100) As Integer
  num = 0
      If Len(Text1.Text) = 0 Then
        MsgBox "请先执行“读数据”功能!"
  Else
      '考生编写(功能:生成 b 数组,且按从小到大顺序排序)
      '注意:请务必将数组 b 的元素个数存入变量 num 中
=====================
???
=====================
      '以下程序段将已排序的 b 数组显示在Text2中
      For i = 1 To num
          Text2.Text = Text2.Text + Str(b(i)) + Space(2)
      Next i
  End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
    Open App.Path & "\out5.dat" For Output As #1
    Print #1, Text2.Text
    Close #1
End Sub
查看答案
      For i = 1 To 100
          If a(i) / 3 = Fix(a(i) / 3) Then
            num = num + 1
            b(num) = a(i)
          End If
      Next
      For i = 1 To num - 1
          For j = i + 1 To num
            If b(i) > b(j) Then
                tem = b(i)
                b(i) = b(j)
                b(j) = tem
            End If
          Next
      Next
← 上一卷下一卷 →