①要求用Visual Basic对象的思想来完成程序的设计。
②在设计程序的过程中,要求会使用按钮(commandbutton)、文本框(text)、标签(label)等基本控件的属性、方法和相关事件。
③欲完成此设计题目,要求在设计的程序中要用到两个窗体及相关控件的多个属性和方法。
④第一个窗体界面中表示数字的控件要用控件数组表示。
⑤完成的程序界面要美观,程序能够正确测试四则运算结果是否正确并显示答题情况。
①提供第一个窗体的参考界面:
②利用第一个窗体上控件进行四则运算,在第二个窗体的Picture控件内显示“一共做了多少题,计算正确的有多少题,计算错误的有多少题,得分是多少。
③运算时用鼠标点击控件数组的数字键,操作数出现在相应的文本框中,然后选择进行哪种运算,在第三个文本框输入运算结果,按回车键。
④通过第一个窗体上的“答题情况“按钮随时可以在第二个窗体查看答题情况,再按第二个窗题上的“继续答题”按钮返回第一个窗体继续答题。

解决方案 »

  1.   

    VB编写的计算器:
    http://www.baidu.com/s?bs=VB+%CC%E6%BB%BBexe%CD%BC%B1%EA&f=3&wd=vb+%BC%C6%CB%E3%C6%F7%B4%FA%C2%EB&oq=vb+%BC%C6%CB%E3%C6%F7&rsp=0
      

  2.   

    Option Explicit
    Dim num#, s1%, L%, t1$, t2$, i%, smm$, pi#, answer$, a() As Integer
    Dim Ileft As Integer       ' 左值
    Dim Itop As Integer        ' 上值
    Dim Ix1 As Integer         ' 鼠标移动前初值
    Dim Iy1 As Integer
    Private Sub Command1_Click(Index As Integer)
     Select Case Index
      Case 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 '数字按钮和小数点
        If Trim$(Label3.Caption) = "" Then
           If Index = 10 Then
              Label3.Caption = ""
              Exit Sub
           End If
        End If
        If Index = 10 Then
           t1 = "."
           L = Len(Label3)
           ReDim a(L)
           For i = 1 To L
            t2 = Mid(Label3, i, 1)
            If t1 = t2 Then Exit Sub
            Next
        End If
        Label3 = Label3 + Command1(Index).Caption
      Case 11, 12, 13, 14 '符号按钮
         If Label3 = "" Then Exit Sub
            num = Label3: Label3 = ""
            s1 = Index
      Case 15 '删除按钮
        If Label3 = "" Then Exit Sub
          L = Len(Label3)
          Label3 = Mid(Label3, 1, L - 1)
      Case 16 '清除按钮
        Label3 = ""
      Case 17 '等于按钮
        
       If Label3 = "" Then Exit Sub
        If s1 = 11 Then
          smm = num + Val(Label3)
           If Mid(smm, 1, 1) = "." Then
             Label3 = "0" & smm
            Else: Label3 = smm
          End If
        End If
       
       If s1 = 12 Then
         smm = num / Val(Label3)
               If Mid(smm, 1, 1) = "." Then
                 Label3 = "0" & smm
                Else: Label3 = smm
               End If
          End If
       If s1 = 13 Then
          smm = num * Val(Label3)
                If Mid(smm, 1, 1) = "." Then
                  Label3 = "0" & smm
                 Else: Label3 = smm
                End If
          End If
       If s1 = 14 Then
         smm = num - Val(Label3)
                If Mid(smm, 1, 1) = "." Then
                  Label3 = "0" & smm
                 Else: Label3 = smm
                End If
          End If
     Case 18 '正负按钮
       If Label3 = "" Then Exit Sub
         If Left(Label3, 1) = "-" Then
           t2 = Mid(Label3, 2, Len(Label3))
           Label3 = t2
           Exit Sub
         End If
          Label3 = "-" & Label3
      Case 19 '平方根按钮
        If Label3 = "" Then Exit Sub
        If Val(Label3) < 0 Then Exit Sub
          smm = Sqr(Label3)
            If Mid(smm, 1, 1) = "." Then
              Label3 = "0" & smm
             Else: Label3 = smm
            End If
      Case 20 '百分数按钮
         If Label3 = "" Then Exit Sub
          smm = Label3 / 100
                 If Mid(smm, 1, 1) = "." Then
              Label3 = "0" & smm
             Else: Label3 = smm
            End If
      Case 21, 22, 23, 24 '三角函数按钮
        pi = 4 * Atn(1)
       If Label3 = "" Then Exit Sub
       If Index = 21 Then
           If (Val(Label3) / 90) Mod 2 <> 0 Then
             answer = MsgBox("极值,无法显示!", 48, "提示")
              If answer = 1 Then Label3 = "": Exit Sub
            Else: smm = Tan((Label3 * pi) / 180)
                If Mid(smm, 1, 1) = "." Then
                  Label3 = "0" & smm
                Else: Label3 = smm
           End If
            End If
           If Val(Label3) Mod 90 <> 0 Then
              smm = Tan((Label3 * pi) / 180)
                If Mid(smm, 1, 1) = "." Then
                  Label3 = "0" & smm
                Else: Label3 = smm
               End If
           End If
          If Val(Label3) = 0 Or (Val(Label3) / 90) Mod 2 = 0 Then Label3 = 0
       End If
       If Index = 22 Then
           smm = Sin((Label3 * pi) / 180)
            If Mid(smm, 1, 1) = "." Then
              Label3 = "0" & smm
             Else: Label3 = smm
            End If
        End If
       If Index = 23 Then
          smm = Cos((Label3 * pi) / 180)
            If Mid(smm, 1, 1) = "." Then
              Label3 = "0" & smm
             Else: Label3 = smm
            End If
        End If
       If Index = 24 Then Label3 = (Atn(Label3) * 180) / pi
     End Select
    End Sub
      

  3.   

    Dim Ileft As Integer ' 左值
    Dim Itop As Integer ' 上值
    Dim Ix1 As Integer ' 鼠标移动前初值
    Dim Iy1 As Integer
    这些不要