⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 st5_2.frm

📁 一个参考书上的习题答案,希望对大家有所帮助
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   3090
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   ScaleHeight     =   3090
   ScaleWidth      =   4680
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command5 
      Caption         =   "退出"
      Height          =   375
      Left            =   2160
      TabIndex        =   19
      Top             =   2280
      Width           =   735
   End
   Begin VB.CommandButton Command4 
      Caption         =   "="
      Height          =   375
      Left            =   1440
      TabIndex        =   18
      Top             =   2280
      Width           =   735
   End
   Begin VB.CommandButton Command3 
      Caption         =   "清屏"
      Height          =   375
      Left            =   720
      TabIndex        =   17
      Top             =   2280
      Width           =   735
   End
   Begin VB.CommandButton Command2 
      Caption         =   "mod"
      Height          =   375
      Index           =   4
      Left            =   120
      TabIndex        =   16
      Top             =   2280
      Width           =   615
   End
   Begin VB.CommandButton Command2 
      Caption         =   "/"
      Height          =   375
      Index           =   3
      Left            =   2880
      TabIndex        =   15
      Top             =   1680
      Width           =   615
   End
   Begin VB.CommandButton Command2 
      Caption         =   "*"
      Height          =   375
      Index           =   2
      Left            =   2280
      TabIndex        =   14
      Top             =   1680
      Width           =   615
   End
   Begin VB.CommandButton Command2 
      Caption         =   "-"
      Height          =   375
      Index           =   1
      Left            =   2880
      TabIndex        =   13
      Top             =   1320
      Width           =   615
   End
   Begin VB.CommandButton Command2 
      Caption         =   "+"
      Height          =   375
      Index           =   0
      Left            =   2280
      TabIndex        =   12
      Top             =   1320
      Width           =   615
   End
   Begin VB.CommandButton Command1 
      Caption         =   "."
      Height          =   375
      Index           =   10
      Left            =   2880
      TabIndex        =   11
      Top             =   960
      Width           =   615
   End
   Begin VB.CommandButton Command1 
      Caption         =   "0"
      Height          =   375
      Index           =   9
      Left            =   2280
      TabIndex        =   10
      Top             =   960
      Width           =   615
   End
   Begin VB.CommandButton Command1 
      Caption         =   "9"
      Height          =   375
      Index           =   8
      Left            =   1440
      TabIndex        =   9
      Top             =   1680
      Width           =   615
   End
   Begin VB.CommandButton Command1 
      Caption         =   "8"
      Height          =   375
      Index           =   7
      Left            =   840
      TabIndex        =   8
      Top             =   1680
      Width           =   615
   End
   Begin VB.CommandButton Command1 
      Caption         =   "7"
      Height          =   375
      Index           =   6
      Left            =   240
      TabIndex        =   7
      Top             =   1680
      Width           =   615
   End
   Begin VB.CommandButton Command1 
      Caption         =   "6"
      Height          =   375
      Index           =   5
      Left            =   1440
      TabIndex        =   6
      Top             =   1320
      Width           =   615
   End
   Begin VB.CommandButton Command1 
      Caption         =   "5"
      Height          =   375
      Index           =   4
      Left            =   840
      TabIndex        =   5
      Top             =   1320
      Width           =   615
   End
   Begin VB.CommandButton Command1 
      Caption         =   "4"
      Height          =   375
      Index           =   3
      Left            =   240
      TabIndex        =   4
      Top             =   1320
      Width           =   615
   End
   Begin VB.CommandButton Command1 
      Caption         =   "3"
      Height          =   375
      Index           =   2
      Left            =   1440
      TabIndex        =   3
      Top             =   960
      Width           =   615
   End
   Begin VB.CommandButton Command1 
      Caption         =   "2"
      Height          =   375
      Index           =   1
      Left            =   840
      TabIndex        =   2
      Top             =   960
      Width           =   615
   End
   Begin VB.CommandButton Command1 
      Caption         =   "1"
      Height          =   375
      Index           =   0
      Left            =   240
      TabIndex        =   1
      Top             =   960
      Width           =   615
   End
   Begin VB.TextBox Text1 
      Height          =   495
      Left            =   360
      TabIndex        =   0
      Top             =   120
      Width           =   3255
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim flg As Boolean, op As Integer, first As Single
Private Sub Command1_Click(Index As Integer)
If Index = 10 Then
    Text1.Text = Text1.Text & "."
Else
    Text1.Text = Text1.Text & CStr(Index)
End If
If Len(Text1) = 2 And Left(Text1, 1) = "0" And Mid(Text1, 2, 1) <> "." Then
   Text1 = Mid(Text1, 2)
End If
End Sub

Private Sub Command2_Click(Index As Integer)
first = Val(Text1.Text)
op = Index
Text1.Text = ""
End Sub

Private Sub Command3_Click()
Text1.Text = ""
first = 0
End Sub

Private Sub Command4_Click()
Dim sec As Single
sec = Val(Text1.Text)
Select Case op
  Case 0
    Text1.Text = Str(first + sec)
    Case 1
    Text1.Text = Str(first - sec)
    Case 2
    Text1.Text = Str(first * sec)
    Case 3
      If sec <> 0 Then
          Text1.Text = Str(first / sec)
      Else
          Text1.Text = "除数为0"
    End If
    Case 4
      If sec <> 0 Then
          Text1.Text = Str(first Mod sec)
      Else
         Text1.Text = "除数为0"
      End If
  End Select
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -