急求VB作业解答!!!急! 只是写代码。不要程序。。谢谢各位大侠了。。。。

作者&投稿:王终 (若有异议请与网页底部的电邮联系)
vb作业 不会写程序代码 帮忙~

Private Sub Command1_Click()
Dim a(9) As Integer
Dim temp As Integer, s As Integer

Randomize

For i = 0 To 9
a(i) = Fix(Rnd * 71) + 30
Print a(i);
Next
Print

temp = a(0)
For i = 1 To 9
If a(i) > temp Then temp = a(i)
Next
Print "最大值"; temp

temp = a(0)
For i = 1 To 9
If a(i) < temp Then temp = a(i)
Next
Print "最小值"; temp

For i = 0 To 9
s = s + a(i)
Next
Print "平均值"; s / 10

End Sub

Private Sub HScroll1_Change() ‘创建滚动条改变事件
Dim temp As Single ’定义变量
Dim w As Single

Dim h As Single

Dim p As Single

p = Picture1.Height / Picture1.Width ‘设置p的初始值为picture1控件的高度跟宽度比
If HScroll1.Value < 10.0000001 Then Picture2.Cls
temp = HScroll1.Value * 0.1
'Picture2.Width = 5600 * temp
'Picture2.Height = 5600 * p * temp’判断,如果滚动条的值小于10.0000001 .那么picture2控件内容清空。Temp变量的值设置为滚动条当前值乘以0.1,重新设置picture2控件的宽度跟高度

Picture2.PaintPicture Picture1.Picture, 0, 0, 5600 * temp, 5600 * p * temp, _
0, 0, Picture1.Width, Picture1.Height‘重新设置picture2控件的画面。实际是把picture1中的图片在picture2中定义的位置中显示,
Else
temp = HScroll1.Value
Picture2.Width = 5600
Picture2.Height = 4200
w = Picture1.Width / (temp - 10)
h = Picture1.Height / (temp - 10)
Picture2.PaintPicture Picture1.Picture, 0, 0, Picture2.Width, Picture2.Height, _
0, 0, w, h

’如果滚动条的当前值大于 10.0000001的话,重新设置picture2控件的宽跟高,初始化picture2中的画面。 ‘这个程序实际上就是根据当前滚动条的值来改变picture1控件中图片在picture2控件中的显示位置跟大小的
End If


End Sub

1.
Private Sub Command1_Click()
Dim a!, b!, c!, d!
a = CSng(Text1.Text)
b = CSng(Text2.Text)
c = CSng(Text3.Text)
d = b ^ 2 - 4 * a * c
If a = 0 Then
MsgBox "这不是二次方程"
Exit Sub
Else
Text4.Text = Format((-b + Sqr(d)) / a / 2, "0.0000")
Text5.Text = Format((-b - Sqr(d)) / a / 2, "0.0000")
End If
End Sub

2,
Private Sub Form_Load() '运行即添加6科目
Dim i%, strKC$
strKC = "语文、数学、英语、政治、生物、物理"
For i = 0 To 5
List1.AddItem Split(strKC, "、")(i)
Next
End Sub

Private Sub Command1_Click() '添加
List1.AddItem Text1.Text
End Sub

Private Sub Command2_Click() '删除
List1.RemoveItem List1.ListIndex
End Sub

Private Sub command3_Click() '全部清除
List1.Clear
End Sub

1、
Private Sub Command1_Click()
Dim Delta
Dim a, b, c
a = Val(Text1)
b = Val(Text2)
c = Val(Text3)
Delta = b ^ 2 - 4 * a * c
If Delta < 0 Then MsgBox "没有实根": Exit Sub
Text4 = (-b - Sqr(Delta)) / (2 * a)
Text5 = (-b + Sqr(Delta)) / (2 * a)
End Sub

2、
Private Sub command1_click()
List1.AddItem Text1
End Sub
Private Sub command2_click()
List1.RemoveItem List1.ListIndex
End Sub
Private Sub command3_click()
List1.Clear
End Sub

2题
Dim strAdd As String
Private Sub command1_click()
strAdd = Text1.Text
List1.AddItem strAdd
End Sub
Private Sub command2_click()
List1.RemoveItem List1.ListIndex
End Sub
Private Sub command3_click()
List1.Clear
End Sub

第一题:
Dim a As Integer, b As Integer, c As Integer

Private Sub Command1_Click()
a = Val(Text1.Text)
b = Val(Text2.Text)
c = Val(Text3.Text)
d = b ^ 2 - 4 * a * c
If d < 0 Then
MsgBox "方程无实数根"
ElseIf d = 0 Then
Text4.Text = -b / (2 * a)
Text5.Text = -b / (2 * a)
ElseIf d > 0 Then
Text4.Text = (-b + sqr(d)) / (2 * a)
Text5.Text = (-b - sqr(d)) / (2 * a)
End If
End Sub

Private Sub Command1_Click()
a = Text1.Text
b = Text2.Text
c = Text3.Text
d = b * b - 4 * a * c
If d >= 0 Then
Text4.Text = (-b + Sqr(d)) / (4 * a)
Text5.Text = (-b - Sqr(d)) / (4 * a)
End If
If d < 0 Then
MsgBox ("没有实根")
End If
End Sub