修改时间:2024-07-12 浏览次数:254 类型:高考模拟
Private Sub Command1 Click()
Dim cm,kg,sc As Integer
Dim i as Single
cm = Val(Text1.Text)
kg = val(Text2.Text)
sc = 0
i = 0
If Check1 = 0 Then
sc = (cm - 80) * 0.7
Else
End If
i = (kg - sc) / kg
If i >= -0.1 And i <= 0.1 Then
Label3.Caption = "正重体重"
ElseIf i > 0.1 And i <= 0.2 Then
Label3.Caption = "体重超重"
ElseIf i > 0.2 Then
ElseIf i <= -0.1 And i >= -0.2 Then
Label3.Caption = "体重过轻"
Else
Label3.Caption = "体重严重不足"
End If
End Sub
Private Sub Command1 click( )
Dim a(1 to 3) as integer,k as integer,t as integer,s as integer
a(1)=15: a(2)=36: a(3)=7
s=0
For k=2 to 3
if a(k)>a(1) then
t=a(1):a(1)=a(k):a(k)=t
s=s+1
End if
Next k
text1.text=str(a(1))
text2.text=str(s)
End sub
请在下列程序代码的基础上按照要求设计该程序, 完善程序中的划线部分。
Dim n As Integer, a1 As Integer, a2 As Integer, a3 As Integer
Function f(x) As Boolean
f = True
For i = 2 To Sqr(x)
If x Mod i = 0 Then
Next i
End Function
Private Sub Command1 Click()
n =
For a1 = 2 To n
For a2 = a1 To n
For a3 = a2 To n
If And f(a1) And f(a2) And f(a3) Then
List1.AddItem (Str(a1) + " " + Str(a2) + " " + Str(a3))
End If
Next a3
Next a2
Next a1
End Sub
Private Sub Command1 Click()
Dim adocn As New adodb.Connection
Dim adors As New adodb.Recordset
Dim str2 As String, str1 As String
str1 = "Provider=Microsoft.ACE.OLEDB.12.0;data source=f:\2015mt\vb\ "
adocn.Open str1
str2 = "select * from students where num=" + Text1.Text
adors.Open str2, adocn, adOpenDynamic, adLockOptimistic
If adors.EOF = True Then
MsgBox "你输入的学号不存在"
Else
Text2.Text = adors.Fields("name").Value
Text3.Text = adors.Fields("sex").Value
End If
adors.Close
adocn.Close
End Sub
试题篮