内容发布更新时间 : 2025/1/9 11:02:24星期一 下面是文章的全部内容请认真阅读。
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim rand As New Random()
Dim x(1) As Byte, y1 As Integer, y2, z As Single rand.NextBytes(x)
MsgBox(x(0) & Space(3) & x(1)) y1 = rand.Next(1, 100) y2 = rand.NextDouble() z = Microsoft.VisualBasic.Rnd()
MsgBox(y1 & Space(3) & y2 & Space(3) & z) End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim x As String
x = InputBox(\输入任一字符串\输入对话框\ MsgBox(x & \字符串的长度是:\ End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim x As String
x = InputBox(\输入任一含有?stu?的字符串\输入对话框\
MsgBox(\在\字符串的第一个起始位置是:\ End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click Dim x As String x = \ Visual C ++ \ MsgBox(\ End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click Dim x As String
x = \我去资料室查资料\
MsgBox(\的字节数为:\ End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
Dim x As String
x = \料资查室料资去我\
MsgBox(\的反序排列为:\ End Sub
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click Dim x, y As String
x = \我去资料室查资料\ MsgBox(\ y='\ End Sub
Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
Dim x, y As String
x = \我去资料室查资料\ MsgBox(\ y='\ End Sub
Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click Dim x, y As String
x = \6, 5)
MsgBox(\Chr(34)) End Sub
Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click Dim x As Integer
x = Asc(\
MsgBox(\的ASCII码是:\ End Sub
Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click Dim d1, d2 As Date, n1, n2, n3 As Integer d1 = #1/1/2013# : d2 = Now()
n1 = DateDiff(DateInterval.Month, d1, d2) n2 = DateDiff(DateInterval.Weekday, d1, d2) n3 = DateDiff(DateInterval.Day, d1, d2) MsgBox(n1 & Space(2) & n2 & Space(2) & n3)
End Sub
Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click Dim x As String x = \
MsgBox(Format(Val(x), \ MsgBox(Format(x, \ End Sub
Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button13.Click MsgBox(Format(3287.153, \ End Sub
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click '用实验30-1-(1)
Dim a As String, b As String, c As String Dim x1 As Single, x2 As Single
a = InputBox(\输入A\输入据Y\ b = InputBox(\输入B\输入数据Y\ c = InputBox(\输入C\输入数据Y\ x1 = -b + Math.Sqrt(b ^ 2 - 4 * a * c) / 2 / a x2 = -b - Math.Sqrt(b ^ 2 - 4 * a * c) / 2 / a
MsgBox(\ x2=\\ End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click '实验30-1-(2)
Dim x, y As Integer, z As Single x = 5 : y = 9
z = (x ^ 3 + x * y + y ^ 3) / (2 * x * y)
MsgBox(\ End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click '实验30-1-(3)
Dim x, y As Single
x = InputBox(\输入数值x\
y = Math.Log(20) + Math.Abs(x - 16) MsgBox(\ End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click '实验30-1-(4)
Dim x, y As Single
x = InputBox(\输入数值x\ y = 0.231 * x + 1.36
MsgBox(\ End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click '实验30-1-(5) Dim x, y, t, s As Single Const g = 9.81
x = InputBox(\输入初速度x\
y = InputBox(\输入斜抛方向与地面的夹角y\ t = 2 * x * Math.Sin(y * Math.PI / 180) / g
s = x * Math.Sin(2 * y * Math.PI / 180) / g
MsgBox(\落地使用的时间t=\秒 落地时物体运动的射程s=\米\ End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click '用IF-Then语句编写奇偶数 Dim x As Integer
'Randomize '初始化随机数生成器
x = Int(Microsoft.VisualBasic.Rnd() * 100)
If Int(x / 2) = x / 2 Then '判断数是否奇偶。用2除该数,该数取整等于其不取整的结果即为偶数。
MsgBox(x & \是偶数\ Else
MsgBox(x & \是奇数\ End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click '在3个数中找出最大值和最小值
Dim x As Single, y As Single, z As Single, max_num As Single, min_num As Single x = InputBox(\请输入第一个数\ y = InputBox(\请输入第二个数\ z = InputBox(\请输入第三个数\ max_num = x : min_num = x If y > max_num Then max_num = y If z > max_num Then max_num = z If y < min_num Then min_num = y
If z < min_num Then min_num = z
MsgBox(\最大数是 \ 最小数是 \ End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
'用IF-Then-Else-Endif 编写变量t分段求值的计算程序
Dim t As Integer, f As Single
t = Val(InputBox(\请输入 t值(∞,120)或者[120,∞):\输入自变量tz值\ If t < 120 Then f = 0.06 * t + 2 Else
f = 0.06 * t * 0.85 End If
MsgBox(\ End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
'用IF-Then-Else-Endif 编写成绩等级评定程序
Dim grade As Integer
grade = InputBox(\请输入您的考试成绩\ If grade > 90 Then
MsgBox(\您的考试成绩为A级\ ElseIf grade >= 80 Then
MsgBox(\您的考试成绩为B级\ ElseIf grade >= 70 Then
MsgBox(\您的考试成绩为C级\ ElseIf grade >= 60 Then