VB程序填空(Option Explicit)1

更新时间:2023-07-10 03:19:33 阅读: 评论:0

1.Option Explicit'题目:窗体上建立了一个文本框Text1("输入口令")和一个命令按钮Command1("检查")。判断密码是否正确,并显示相应提示;在加载窗体时设置密码框最大长度为8,密码显示字符为“*
Private Sub Command1_Click()
      x = Text1.Text
          If x 【? ?】"12345678" Then      like =,不定)
          MsgBox ("欢迎你用机!")
      El
          MsgBox ("对不起,口令错")
      End If
      Text1.Text = ""
      Text1.SetFocus
End Sub
---------------------------------------------------------------------------------------------------------------------
Private Sub Form_Load()
Text1.Text = ""
Text1.【 =8                                    (maxlength)
    Text1. ?】="*"                (passwordchar)
End Sub
2.'题目:以下程序的功能如(1)
Private Sub Form_Click()
Dim a%, b%, c%, d!
Dim x1, x2
Dim p, q, r
a = InputBox("请输入a的值")
b = InputBox("请输入b的值")
c = InputBox("请输入c的值")
d = b * b - 4 * a * c
p = -b / (2 * a)
If d >= 0 Then
  If   Then                                (d>0)
    r = Sqr(d) / (2 * a)
    x1 = p + r
    x2 = p - r
  El
    x1 = p
    x2 = p
露出文  【? ?】                          end if
  Print "x1="; x1, "x2="; x2
                            el花胶鸡汤的做法)
  q = Sqr(-d) / (2 * a)
  Print "x1="; p; "+"; q; "i", "x2="; p; "-"; q; "i"
End If
End Sub
3.'下面过程max()用于求3个数中最大值,利用这个过程求5个数中最大值。
Private Sub Form_Click()
Print "5个数34、124、68、73、352的最大值是:"
max1 = max(34, 124, 68)
max1 = max(【?】)                            (max1, 73, 352)
Print max1
End Sub
Public Function max(ByVal a%, ByVal b%, ByVal c%)
If a > b Then
  m = 【?】                                      a草莓榨汁最佳搭配 
El
  m = b
End If
If m 【? ?】Then                                  > c
  max = m
El
乘法的验算  max = c
End If
End Function
4.'下面的程序段用于求矩阵相乘C=A×B,设ABC分别为m×pp×nm×饱满的热情n的矩阵。
Private Sub Form_Click()
Const m = 4, p = 3, n = 2
Dim a(1 To m, 1 To p) As Integer
Dim b(1 To p, 1 To n) As Integer
Dim c(1 To m, 1 To n) As Integer
Dim i As Integer, j As Integer, k As Integer, sum As Integer
非洲的纬度位置
For i = 1 To m
  For k = 1 To p
    a(i, k) = i
  Next k
Next i
工作个人鉴定
For i = 1 To p
  For k = 1 To n
    b(i, k) = i
  Next k
Next i
For i = 1 To m
  For j = 1 To n
      【? ?】
    For k = 1 To p
      sum = sum +  
    Next k
    c(i, j) =  
Next j, i
Print "输出矩阵"
For i = 1 To m
  For k = 1 To n
    Print c(i, k),
  Next k
  Print
Next i
End Sub
5. '题目:本程序功能为,单击窗体,Form1的输出结果为
'A1=10        B1=20
'A2=20        B2=10
Public Sub Swap1 x As Integer, ByVal y As Integer)
  Dim t As Integer
  t = x
  x = y
  y = t
End Sub
------------------------------------------------------------------------------------------------------------------
Public Sub Swap2(x As Integer, y As Integer)
  Dim t As Integer
  t = x
  x = y
  y = t
End Sub
-------------------------------------------------------------------------------------------------------------------
Private Sub Form_Click()
  Dim a As Integer, b As Integer
  a = 10
  b = 20
    a, b
  Print
  Form1.Print "A1="; a, "B1="; b
  a = 10
  b = 20
    a, b
  Form1.Print "A2="; a, "B2="; b
End Sub
======================================================================
6. '题目:下面是一个体操评分程序,10位评委,除去一个最
高分和一个最低分,计算平均分  (设满分为  10 
Private Sub Command1_Click()
经常憋尿会引起什么病
    Dim s As Integer
    Dim Max, Min As Integer
    Dim i, n, p As Integer
 
s = 0
    Max = 10
    For i = 1 To 10
        n = Val(InputBox("  请输入分数:  "))
if n>max then max ?  ? =n
        If n < Min Then Min = n
        s = s + n
Next I
S=S-Max -Min
    p = s / 8
    Print "最高分  :"; Max
    Print "最低分  :"; Min
    Print "最后得分:"; p
End Sub
7.'根据输入的学习成绩,分别显示优秀(90分以上), 良好(75分以上),
'及格(60分以上),不及格几个等级。'
Private Sub Command1_Click()
x = Val(Text1.Text)
If x >= 90 Then
        Label1.Caption = "优秀"
ElIf x    Then                                   ( >= 75)
        Label1.Caption = "良好"
                                (ElIf x >= 60 Then)
    Label1.Caption = "及格 "
                                            (El)
      Label1.Caption = "不及格"
End If
End Sub
======================================================================
(少了第八题
======================================================================
9. '题目:窗体中有Text1-Text77个文本框,单击按钮Command1Text7中显示前6个文本框中的数值的最大数
Private Sub Command1_Click()
      Dim a, b, c, d, e, f, m As Integer

本文发布于:2023-07-10 03:19:33,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/89/1075208.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:窗体   输入   密码   题目   利用
相关文章
留言与评论(共有 0 条评论)
   
验证码:
推荐文章
排行榜
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图