题库 题库
🏠 天天查询 > 题库 > VB

VB

简答题 查看答案
简答题 查看答案
简答题 查看答案
简答题  
Private Sub C1_Click()
    Dim k As Integer
    For k = 0 To 2
'        If Op1(k).? = True Then
'            Call draw(?)
        End If
    Next k
End Sub
Sub draw(a As Integer)
    P1.Print "选择了" & Op1(a).Caption
End Sub
查看答案
简答题  
Private Function IsPrime(ByVal x As Integer) As Boolean
    Dim i As Integer
    For i = 2 To Sqr(x)
        If x Mod i = 0 Then
            IsPrime = False
            Exit Function
        End If
    Next
    IsPrime = True
End Function
Private Sub Command1_Click()
'考生编写程序开始
'======================================
  ????
'=========================================
'考生编写程序结束
    Open App.Path & "\out5.dat" For Output As #1
    Print #1, Text1.Text, Label1(0).Caption, Label1(1).Caption, Label1(2).Caption
    Close #1
End Sub
查看答案
简答题 查看答案
简答题 查看答案
简答题  
'提供给考生
'Private Sub C1_Click()
''    For i = ? To ?
''        If Op1(i).? = True Then
''            Print "我的出生地是" + Op1(i).?
'        End If
'    Next
'End Sub
查看答案
简答题  
'提供给考生的程序
Private Sub Form_Unload(Cancel As Integer)
    Open App.Path & "\out4.txt" For Output As #1
    Print #1, Cb1.Text, Cb2.Text, CInt(L1.Font.Size), L1.Font
    Close #1
End Sub
查看答案
简答题  
'提供给考生的程序
Private Function isprime(a As Integer) As Boolean
    Dim flag As Boolean
    flag = True
    b% = 2
    Do While b% <= Int(a / 2) And flag
        If Int(a / b%) = a / b% Then
            flag = False
        Else
            b% = b% + 1
        End If
    Loop
    isprime = flag
End Function
查看答案
简答题 查看答案
简答题 查看答案
简答题  
Private Sub Op1_Click(Index As Integer)
''给考生的程序:
'    Dim a As String, b As String, c As String
'    a = "我坐"
'    b = "我开"
''    Select Case ?
'        Case 0
'            Text1.Text = a + Me.Op1(0).Caption + "去"
'        Case 1
''            Text1.Text = ? + Me.Op1(1).Caption + "去"
'        Case 2
'            Text1.Text = b + Me.Op1(2).Caption + "去"
'    End Select
查看答案
简答题  
'提供给考生的程序
Private Sub Form_Unload(Cancel As Integer)
    Open App.Path & "\out4.txt" For Output As #1
    Print #1, Op1.Value, Op2.Value, Op3.Value, Op4.Value, Text1.Text
    Close #1
End Sub
查看答案
简答题  
' 给考生的程序
Private Sub Form_Unload(Cancel As Integer)
    unload_sub
End Sub
查看答案
简答题 查看答案
简答题   查看答案
简答题  
''给考生的程序
'Private Sub C1_Click()
''    Timer1.Enabled = ?
'End Sub
'Private Sub Timer1_Timer()
'    Static a%
'    a = a + 1
''    If P1.Top > P2.Top + P2.? Then
'        P1.Move P1.Left, P1.Top - 5 - a, P1.Width, P1.Height
'    Else
''        Timer1.? = False
'    End If
'End Sub
查看答案
简答题  
Private Function xn(a As Single, m As Integer)
    Dim i As Integer
    tmp = 1
    For i = 1 To m
    '    tmp = ?
    Next
    'xn = ?
End Function
Private Sub Command1_Click()
    Dim n As Integer
    Dim i As Integer
    Dim t As Single
    Dim s, x As Single
    n = Val(Text1.Text)
    x = Val(Text2.Text)
    z = 0
    For i = 2 To n
        t = x + i
    '    z = z +?
    Next
    'Label1.Caption = ?
    Call SaveResult
End Sub
Private Sub SaveResult()
    Open App.Path & "\out4.dat" For Output As #1
    Print #1, Label1.Caption
    Close #1
End Sub
查看答案
简答题  
Private arr(100) As Integer
Private Sub Command1_Click()
    Open App.Path & "\in5.txt" For Input As #1
    For i = 1 To 40
        Input #1, arr(i)
    Next
    Close #1
End Sub
Private Sub Command2_Click()
'=================考生编写程序开始===================
???
'=================考生编写程序结束====================
    Open App.Path & "\out5.txt" For Output As #1
    Print #1, Label3.Caption, Label4.Caption
    Close #1
End Sub
Public Function prime(x As Integer)
    k = Int(Sqr(x) + 0.5)
    For i = 2 To k
        If x Mod i = 0 Then
            prime = False
            Exit Function
        End If
    Next
    If i > k Then prime = True
End Function
查看答案
简答题 查看答案
简答题 查看答案
简答题 查看答案
简答题 查看答案
简答题  
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()
  Dim n As Integer, t As String, word_num As Integer
  n = Len(s): t = ""
  For i = 1 To n
      c = Mid(s, i, 1)
      If c <> " " Then
        t = t + c
      Else
        If foundhuiwen(t) Then
            word_num = word_num + 1
        End If
        t = ""
      End If
  Next i
  Text1.Text = word_num
End Sub
'以下Function 过程用于判断字符串是否为回文
Function foundhuiwen(p As String)
  '考生编写
查看答案
简答题 查看答案
简答题 查看答案
简答题  
Private Sub Command1_Click()
    Text1.Text = InputBox("请输入要添加的项目")
    'List1.AddItem ?
End Sub
Private Sub Command2_Click()
    Text1.Text = InputBox("请输入要删除的项目")
    'For i = 0 To ?
        'If List1.List(i) = ? Then
        If List1.List(i) = Me.Text1.Text Then
            'List1.RemoveItem ?
        End If
    Next i
End Sub
查看答案
简答题  
Option Base 1
Private Function FindMax(a() As Integer)
    Dim Start As Integer
    Dim Finish As Integer, i As Integer
    'Start = ?(a)
    'Finish = ?(a)
    'Max = ?(Start)
    For i = Start To Finish
        'If a(i) ? Max Then Max = ?
    Next i
    FindMax = Max
End Function
Private Sub Command1_Click()
    Dim arr1
    Dim arr2(4) As Integer
    'arr1 = Array(Val(?), Val(?), Val(?), Val(?))
    For i = 1 To 4
        'arr2(i) = CInt(?)
    Next i
    'M = FindMax(?)
    Print "最大值是: "; M
End Sub
查看答案
简答题  
' 提供给考生的程序
Option Base 1
Dim Arr(100) As Integer
' 提供给考生的程序
Sub ReadData()
    Open App.Path & "\" & "datain1.txt" For Input As #1
        For i = 1 To 100
        Input #1, Arr(i)
    Next i
    Close #1
End Sub
' 提供给考生的程序
Sub WriteData(Filename As String, Num As Integer)
    Open App.Path & "\" & Filename For Output As #1
        Print #1, Num
    Close #1
End Sub
查看答案
简答题 查看答案
简答题 查看答案
简答题  
Private Sub Form_MouseDown(Button As Integer, _
            Shift As Integer, X As Single, Y As Single)
    If Button = 1 Then
        Text1.Text = InputBox("请输入要添加的项目")
        'List1.AddItem ?
    End If
    If Button = 2 Then
    Text1.Text = InputBox("请输入要删除的项目")
    'For i = 0 To ?
        'If List1.List(i) = ? Then
            'List1.RemoveItem ?
        End If
    Next i
    End If
End Sub
查看答案
简答题  
Option Base 1
Private Function FindMin(a() As Integer)
    Dim Start As Integer
    Dim Finish As Integer, i As Integer
    'Start = ?(a)
    'Finish = ?(a)
    'Min = ?(Start)
    For i = Start To Finish
        'If a(i) ? Min Then Min = ?
    Next i
    FindMin = Min
End Function
Private Sub Command1_Click()
    Dim arr1
    Dim arr2(4) As Integer
    arr1 = Array(Val(Text1.Text), Val(Text2.Text), Val(Text3.Text), Val(Text4.Text))
    For i = 1 To 4
        arr2(i) = CInt(arr1(i))
    Next i
    'M = FindMin(?)
    Print "最小值是: "; M
End Sub
查看答案
简答题  
' 提供给考生的程序
Option Base 1
Dim Arr(100) As Integer
' 提供给考生的程序
Sub ReadData()
    Open App.Path & "\" & "datain1.txt" For Input As #1
        For i = 1 To 100
        Input #1, Arr(i)
    Next i
    Close #1
End Sub
' 提供给考生的程序
Sub WriteData(Filename As String, Num As Integer)
    Open App.Path & "\" & Filename For Output As #1
        Print #1, Num
    Close #1
End Sub
查看答案
简答题 查看答案
简答题 查看答案
简答题  
Private Sub Form_KeyDown(KeyCode As Integer, _Shift As Integer)
    If Chr(KeyCode) = "A" Then
        Text1.Text = InputBox("请输入要添加的项目")
        'List1.AddItem ?
    End If
        If Chr(KeyCode) = "D" Then
    Text1.Text = InputBox("请输入要删除的项目")
    'For i = 0 To ?
        'If List1.List(i) = ? Then
            'List1.RemoveItem ?
        End If
    Next i
    End If
End Sub
查看答案
简答题  
Option Base 1
Private Function Average(a() As Integer) As Single
    Dim Start As Integer, Finish As Integer
    Dim i As Integer
    Dim Sum As Integer
    'Start = ?(a)
    'Finish = ?(a)
    'Sum = ?
    For i = Start To Finish
        'Sum = Sum + ?
    Next i
    'Average = ?
End Function
Private Sub Command1_Click()
    Dim arr1
    Dim arr2(4) As Integer
    arr1 = Array(Val(Text1.Text), Val(Text2.Text), Val(Text3.Text), Val(Text4.Text))
    For i = 1 To 4
        arr2(i) = CInt(arr1(i))
    Next i
    'Aver = Average(?)
    Print "平均值是: "; Aver
End Sub
查看答案
简答题  
' 提供给考生的程序
Option Base 1
Dim Arr(100) As Integer
' 提供给考生的程序
Sub ReadData()
    Open App.Path & "\" & "datain1.txt" For Input As #1
        For i = 1 To 100
        Input #1, Arr(i)
    Next i
    Close #1
End Sub
' 提供给考生的程序
Sub WriteData(Filename As String, Num As Integer)
    Open App.Path & "\" & Filename For Output As #1
        Print #1, Num
    Close #1
End Sub
查看答案
简答题 查看答案
简答题 查看答案
简答题 查看答案
简答题  
Option Base 1
Private Sub Sort(a() As Integer)
    Dim Start As Integer, Finish As Integer
    Dim i As Integer, j As Integer, t As Integer
    'Start = ?(a)
    'Finish = ?(a)
    'For i = ? To 2 Step -1
        'For j = 1 To ?
            'If a(j) ? a(j + 1) Then
                t = a(j + 1)
                a(j + 1) = a(j)
                a(j) = t
            End If
        Next j
    Next i
End Sub
Private Sub Command1_Click()
    Dim arr1
    Dim arr2(4) As Integer
    arr1 = Array(Val(Text1.Text), Val(Text2.Text), Val(Text3.Text), Val(Text4.Text))
    For i = 1 To 4
        arr2(i) = CInt(arr1(i))
    Next i
    Sort arr2()
    Text1.Text = arr2(1)
    Text2.Text = arr2(2)
    Text3.Text = arr2(3)
    Text4.Text = arr2(4)
End Sub
查看答案
简答题  
' 提供给考生的程序
Option Base 1
Dim Arr(100) As Integer
' 提供给考生的程序
Sub ReadData()
    Open App.Path & "\" & "datain1.txt" For Input As #1
        For i = 1 To 100
        Input #1, Arr(i)
    Next i
    Close #1
End Sub
' 提供给考生的程序
Sub WriteData(Filename As String, Num As Integer)
    Open App.Path & "\" & Filename For Output As #1
        Print #1, Num
    Close #1
End Sub
查看答案
简答题 查看答案
简答题 查看答案
简答题  
Private Sub Form_Click()
    If Option1.Value = True Then
        Text1.Text = InputBox("请输入要添加的项目")
        'List1.AddItem ?
    End If
    If Option2.Value = True Then
        Text1.Text = InputBox("请输入要删除的项目")
        'For i = 0 To ?
            'If List1.List(i) = ? Then
                'List1.RemoveItem ?
            End If
        Next i
    End If
End Sub
查看答案
简答题  
Option Base 1
Private Sub Sort(a() As Integer)
    Dim Start As Integer, Finish As Integer
    Dim i As Integer, j As Integer, t As Integer
    'Start = ?(a)
    'Finish = ?(a)
    'For i = ? To 2 Step -1
        'For j = 1 To ?
            'If a(j) ? a(j + 1) Then
                t = a(j + 1)
                a(j + 1) = a(j)
                a(j) = t
            End If
        Next j
    Next i
End Sub
Private Sub Command1_Click()
    Dim arr1
    Dim arr2(4) As Integer
    arr1 = Array(Val(Text1.Text), Val(Text2.Text), Val(Text3.Text), Val(Text4.Text))
    For i = 1 To 4
        arr2(i) = CInt(arr1(i))
    Next i
    Sort arr2()
    Text1.Text = arr2(1)
    Text2.Text = arr2(2)
    Text3.Text = arr2(3)
    Text4.Text = arr2(4)
End Sub
查看答案
简答题  
' 提供给考生的程序
Option Base 1
Dim Arr(100) As Integer
' 提供给考生的程序
Sub ReadData()
    Open App.Path & "\" & "datain1.txt" For Input As #1
        For i = 1 To 100
        Input #1, Arr(i)
    Next i
    Close #1
End Sub
' 提供给考生的程序
Sub WriteData(Filename As String, Num As Integer)
    Open App.Path & "\" & Filename For Output As #1
        Print #1, Num
    Close #1
End Sub
查看答案