计算机类二级VB

二级VB上机题库26

10 题含答案VB
共 10 题返回本类
2材料分析题2 / 10
  
查看答案
Private Sub Command1_Click()
Shape1.FillStyle = 3
End Sub
Private Sub Command2_Click()
Form1.Shape1.FillStyle = 2
End Sub
3材料分析题3 / 10
   
Private Sub C1_Click()
    Dim A$, B$, k%, n%
    A$ = ""
    ? = Asc("a") - Asc("A")
    For k% = 1 To Len(Text1.Text)
        B$ = Mid(?)
        If B$ >= "a" And B$ <= "z" Then
            B$ = String(1, Asc(B$) - n%)
        Else
            If B$ >= "A" And B$ <= "Z" Then
                B$ = String(1, Asc(B$) + 32)
            End If
        End If
        A$ = ?
    Next k%
    Text1.Text = A
End Sub
查看答案
    n% = Asc("a") - Asc("A")
        B$ = Mid(Text1.Text, k%, 1)
        A$ = A$ + B$
4材料分析题4 / 10
   
Dim a(100) As Integer, num As Integer
Private Sub Command1_Click()
    Dim k As Integer
    Open App.Path & "\in4.dat" For Input As #1
    For k = 1 To 60
        Input #1, a(k)
        Text1 = Text1 + Str(a(k)) + Space(2)
    Next k
    Close #1
End Sub
Private Sub Command2_Click()
  num = InputBox("请输入一个数")
End Sub
Private Sub Command3_Click()
    For i = 1 To 60
      'If num < a(i) Then ?
    Next i
    'For j = 60 To i ?
      'a(j + 1) =?
    Next j
    '?= num
    Text1 = ""
    '以下程序段将插入后的数组A重新显示在Text1中
    'For k = 1 To ?
        Text1 = Text1 + Str(a(k)) + Space(2)
    Next k
End Sub
查看答案
      If num < a(i) Then Exit For
    For j = 60 To i Step -1
      a(j + 1) = a(j)
    a(i) = num
    For k = 1 To 61
5材料分析题5 / 10
   
Option Base 1
Dim s As String
Private Sub Command1_Click()
    Open App.Path & "\in5.dat" For Input As #1
    s = Input(LOF(1), #1)
    Close #1
End Sub
Private Sub Command2_Click()
'需考生编写
?????
End Sub
Private Sub Form_Unload(Cancel As Integer)
    Open App.Path & "\out5.dat" For Output As #1
    Print #1, Text1.Text, Text2.Text
    Close #1
End Sub
查看答案
    n = Len(s): t = ""
    Dim word_max As Integer, word_num As Integer, word_len As Integer
    For i = 1 To n
    c = Mid(s, i, 1)
    If c <> " " Then
        t = t + c
    Else
        word_len = word_len + Len(t)
        word_num = word_num + 1
        If Len(t) > word_max Then
            word_max = Len(t)
        End If
        t = ""
    End If
    Next i
    Text1.Text = CInt((word_len + Len(t)) / (word_num + 1))
    If Len(t) > word_max Then
        word_max = Len(t)
    End If
    Text2.Text = word_max
7材料分析题7 / 10
  
查看答案
Private Sub Command1_Click()
  Label1.FontName = "宋体"
End Sub
Private Sub Command2_Click()
  Label1.FontName = "黑体"
End Sub
8材料分析题8 / 10
   

   
Private Sub Cmd1_Click()
  '? = Str(Time())
  Text1(1).Text = "": Text1(2).Text = ""
  Cmd1.Enabled = False
  Cmd2.Enabled = True
End Sub
Private Sub Cmd2_Click()
  Text1(1).Text = Str(Time())
  t_start = Hour(Text1(0).Text) * 3600 + Minute(Text1(0).Text) * 60 + Second(Text1(0).Text)
  t_end = Hour(Text1(1).Text) * 3600 + Minute(Text1(1).Text) * 60 + Second(Text1(1).Text)
  t = t_end - t_start
  h = t \ 3600
  m = t \ 60
  If m < t / 60 Then m = m + 1
  s = 0.5
  If m - 3 > 0 Then
    's = ? + (m - 3) * 0.15
  End If
  Text1(2).Text = Str(s) + "元"
      '?= True
  '?= False
End Sub
查看答案
  Text1(0).Text = Str(Time())
    s = s + (m - 3) * 0.15
  Cmd1.Enabled = True
  Cmd2.Enabled = False
9材料分析题9 / 10
  
查看答案
Private Sub Form_Unload(Cancel As Integer)
    Open App.Path & "\out4.txt" For Output As #1
    Print #1, Op1.Value, Op2.Value, Text1.Text, Text2.Text, Text3.Text
    Close #1
End Sub
Private Sub Text3_Click()
    If Op1 Then
        Text3.Text = Text1.Text
        Text1.Text = Text2.Text
        Text2.Text = Text3.Text
        Text3.Text = "交换成功"
    ElseIf Op2 Then
        Text3.Text = Text1.Text & Text2.Text
    End If
End Sub
10材料分析题10 / 10
   
Option Base 1
Dim s As String
Private Sub Command1_Click()
    Open App.Path & "\in5.dat" For Input As #1
    s = Input(LOF(1), #1)
    Close #1
End Sub
Private Sub Command2_Click()
'需考生编写
?????
    If Len(t) > Max_len Then
        Max_len = Len(t)
        Max_word = t
    End If
    Text1.Text = Max_len
    Text2.Text = Max_word
End Sub
Private Sub Form_Unload(Cancel As Integer)
    Open App.Path & "\out5.dat" For Output As #1
    Print #1, Text1.Text, Text2.Text
    Close #1
End Sub
查看答案
    n = Len(s): t = ""
    Dim Max_len As Integer
    For i = 1 To n
        c = Mid(s, i, 1)
        If c <> " " Then
            t = t + c
        Else
            If Len(t) > Max_len Then
                Max_len = Len(t)
                Max_word = t
            End If
            t = ""
        End If
    Next i
← 上一卷下一卷 →