求助VB高手!!急哦~~高分悬赏!!

请大家帮帮忙哦,帮我做两道VB题,答案要分开哦..

是关于过程的编程题..

1.编写一Sub过程,该过程能够根据输入的工资总数确定发给多少张面值一百元,五十元,十元,五元,一元,五角,一角,五分,一分的钞票.运行时,在窗体上用文本框输入工资额,按回车键调用Sub过程计算各种面值的钞票各需多少,并将结果显示在窗体上,界面自定(要求Sub过程只负责计算,不负责显示结果).

2.使用过程的递归调用求5000之内斐波那契数列的值.

谢谢啦!!^^
第二题的原题就是这样的,我不知道有什么公式哦..不过,作业要求选两道做,我这里再加一道题,大家帮帮忙,帮我做两道,3选2哦,不过记得标明题号..谢谢啦~~

3.编写一个应用程序,要求具有下列的功能.每一个功能由一个自定义过程来实现:
1)读入一个n个元素的数组;
2)在数组的后面添加一个元素;
3)在数组中第k个元素前插入一个元素;
4)删除数组中的第k个元素;
5)删除数组中的指定值的元素(建议编写一个检索用的Function过程,检索成功时,函数返回值为检索到的元素的下标).

第一题

'建立一个text1,
Dim R As Single
Dim S(8) As Integer
Private Sub Form_Load()
Form1.AutoRedraw = True
Text1.Text = 578.62
Form1.Width = 11000
Text1.Top = 1000
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
Case 46, 48 To 57
Case 13
If Text1.Text = "" Then Exit Sub
R = Format(Val(Text1.Text), "0.00")
Call Zh(R)
Print "一百元", "五十元", "十元", "五元", "一元", "五角", "一角", "五分", "一分"
For I = 0 To 8
Print S(I),
Next
Case Else
KeyAscii = ""
End Select
End Sub
Function Zh(ByVal I As Single)
I = I * 100
S(0) = I \ 10000
I = I Mod 10000
S(1) = I \ 5000
I = I Mod 5000
S(2) = I \ 1000
I = I Mod 1000
S(3) = I \ 500
I = I Mod 500
S(4) = I \ 100
I = I Mod 100
S(5) = I \ 50
I = I Mod 50
S(6) = I \ 10
I = I Mod 10
S(7) = I \ 5
S(8) = I Mod 5
End Function

第三题

'建立七个command1-7
Option Explicit
Dim Str As String
Dim S() As Single, S1() As Single, Min As Single, Max As Single
Dim N As Integer, I As Integer, K As Integer
Dim Shu As Boolean
Private Sub Command1_Click()
Cls
Str = InputBox("数组元素个数", "输入", 10)
If Str = "" Then Exit Sub
If Val(Str) < 1 Then Exit Sub
N = Int(Val(Str)) - 1
ReDim S(N)
Call Sjsz
For I = 0 To N
Print S(I);
If I Mod 10 = 9 Then Print
Next
Print
Command3.Enabled = True
Command4.Enabled = True
Command5.Enabled = True
Command6.Enabled = True
End Sub

Private Sub Command2_Click()
Cls
Str = InputBox("数组元素个数", "输入", 10)
If Str = "" Then Exit Sub
If Val(Str) < 1 Then Exit Sub
N = Int(Val(Str)) - 1
ReDim S(N)
For I = 0 To N
S(I) = Srsz(I + 1)
Print S(I);
If I Mod 10 = 9 Then Print
Next
Print
Command3.Enabled = True
Command4.Enabled = True
Command5.Enabled = True
Command6.Enabled = True
End Sub

Private Sub Command3_Click()
ReDim S1(N)
For I = 0 To N
S1(I) = S(I)
Next
N = N + 1
ReDim S(N)
For I = 0 To N - 1
S(I) = S1(I)
Next
S(N) = Srsz(N + 1)
For I = 0 To N
Print S(I);
If I Mod 10 = 9 Then Print
Next
Print
End Sub

Private Sub Command4_Click() '3)在数组中第k个元素前插入一个元素;
Str = InputBox("在第几个元素前插入?(" & 1 & "-" & N + 1 & ")", "输入", N)
If Str = "" Then Exit Sub
K = Int(Val(Str))
If K < 1 Or K > N + 1 Then Exit Sub
ReDim S1(N)
For I = 0 To N
S1(I) = S(I)
Next
N = N + 1
ReDim S(N)
S(K - 1) = Srsz(K)
For I = 0 To N
If I < K - 1 Then
S(I) = S1(I)
ElseIf I > K - 1 Then
S(I) = S1(I - 1)
End If
Next
For I = 0 To N
Print S(I);
If I Mod 10 = 9 Then Print
Next
Print
End Sub

Private Sub Command5_Click() '4)删除数组中的第k个元素;
Str = InputBox("删除第几个元素?(" & 1 & "-" & N + 1 & ")", "输入", N)
If Str = "" Then Exit Sub
K = Int(Val(Str))
If K < 1 Or K > N + 1 Then Exit Sub
ReDim S1(N)
For I = 0 To N
S1(I) = S(I)
Next
N = N - 1
ReDim S(N)
For I = 0 To N
If I < K - 1 Then
S(I) = S1(I)
ElseIf I >= K - 1 Then
S(I) = S1(I + 1)
End If
Next
For I = 0 To N
Print S(I);
If I Mod 10 = 9 Then Print
Next
Print

End Sub

Private Sub Command6_Click()
Str = InputBox("删除哪个元素?", "输入", N)
If Str = "" Then Exit Sub
Min = Val(Str)
Do
Max = Cxys(Min)
If Max <> N + 2 Then
MsgBox "删除第" & Max + 1 & "个元素"
ReDim S1(N)
For I = 0 To N
S1(I) = S(I)
Next
N = N - 1
ReDim S(N)
For I = 0 To N
If I < Max Then
S(I) = S1(I)
ElseIf I >= K Then
S(I) = S1(I + 1)
End If
Next
For I = 0 To N
Print S(I);
If I Mod 10 = 9 Then Print
Next
Print
End If
Loop While Max <> N + 2
End Sub

Private Sub Command7_Click()
End
End Sub

Private Sub Form_Load()
Form1.AutoRedraw = True
Form1.Width = 8000
Form1.Height = 6000
Command1.Caption = "产生随机数组"
Command2.Caption = "输入数组"
Command3.Caption = "后面添加"
Command4.Caption = "中间添加"
Command5.Caption = "按位置删除"
Command6.Caption = "按值删除"
Command7.Caption = "退出"
Command3.Enabled = False
Command4.Enabled = False
Command5.Enabled = False
Command6.Enabled = False
End Sub
Function Srsz(ByVal L As Integer) As Single
Do
Str = InputBox("第" & L & "个元素", "输入", L)
If Str = "" Then
Shu = False
Else
Shu = True
Srsz = Val(Str)
End If
Loop While Not Shu
End Function
Private Sub Sjsz()
Str = InputBox("数组元素最小值数", "输入", -100)
If Str = "" Then Exit Sub
Min = Int(Val(Str))
Str = InputBox("数组元素最大值数", "输入", 100)
If Str = "" Then Exit Sub
Max = Int(Val(Str))
If Max < Min Then Exit Sub
Randomize
For I = 0 To N
S(I) = Int(Rnd * (Max - Min)) + Min
Next
End Sub
Function Cxys(ByVal L As Single) As Integer '检索要删除的元素
For I = 0 To N
If S(I) = L Then
Cxys = I
Exit For
Else
Cxys = N + 2
End If
Next
End Function

都运行过。
温馨提示:答案为网友推荐,仅供参考
第1个回答  2008-05-29
第一题没有意思。
我只编了超过100的,还只编到了一元面值,的其它的自己可以编的

Private Sub Command1_Click()
Dim i As Single
Dim j As Single
Dim m, n, n1, m2 As Integer
Call jisuan
End Sub

Private Sub jisuan()
i = Text1.Text
If i >= 100 Then
m = i / 100
n = Fix(m)
Label2.Caption = "确定要发的工资是百元的" & n & "张"
m1 = i - n * 100
If m1 >= 50 Then
Label3.Caption = "确定要发的工资是五十元的" & 1 & "张"
n1 = Fix((m1 - 50) / 10)
Label4.Caption = "确定要发的工资是十元的" & n1 & "张"
m2 = Fix(m1 - 50 - n1 * 10)
If m2 >= 5 Then
Label5.Caption = "确定要发的工资是五元的" & 1 & "张"
Label6.Caption = "确定要发的工资是一元的" & m2 - 5 & "张"
Else
Label5.Caption = "确定要发的工资是五元的" & 0 & "张"
Label6.Caption = "确定要发的工资是一元的" & m2 & "张"
End If
Else
Label3.Caption = "确定要发的工资是五十元的" & 0 & "张"
n1 = Fix(m1 / 10)

Label4.Caption = "确定要发的工资是十元的" & n1 & "张"
m2 = Fix(m1 - n1 * 10)
If m2 >= 5 Then
Label5.Caption = "确定要发的工资是五元的" & 1 & "张"
Label6.Caption = "确定要发的工资是一元的" & m2 - 5 & "张"
Else
Label5.Caption = "确定要发的工资是五元的" & 0 & "张"
Label6.Caption = "确定要发的工资是一元的" & m2 & "张"
End If

End If
第2个回答  2008-05-29
1。
Dim s As String
Dim intZ As Integer
Dim intX As Integer
Dim C(9) As Integer
Private Sub JS(a As Double)
Dim V As Variant
Dim intTemp As Integer
V = Split(Format(CStr(a), "0.00"), ".")
intZ = V(0)
intX = V(1)
C(0) = intZ \ 100
C(1) = (intZ - C(0) * 100) \ 50
C(2) = (intZ - C(0) * 100 - C(1) * 50) \ 10
C(3) = (intZ - C(0) * 100 - C(1) * 50 - C(2) * 10) \ 5
C(4) = intZ - C(0) * 100 - C(1) * 50 - C(2) * 10 - C(3) * 5

C(5) = intX \ 50
C(6) = (intX - C(5) * 50) \ 10
C(7) = (intX - C(5) * 50 - C(6) * 10) \ 5
C(8) = intX - C(5) * 50 - C(6) * 10 - C(7) * 5
End Sub

Private Sub Command1_Click()
Dim str(9) As String
str(0) = "100元张数="
str(1) = "50元张数="
str(2) = "10元张数="
str(3) = "5元张数="
str(4) = "1元张数="
str(5) = "5角张数="
str(6) = "1角张数="
str(7) = "5分张数="
str(8) = "1分张数="

s = Format(Text1.Text, "0.00")
JS Val(s)
Cls
For i = 0 To 8
Print str(i) & C(i)
Next
End Sub

2。
Private Function Fa(m As Integer)
If m = 1 Or m = 2 Then
Fa = 1
Else
Fa = Fa(m - 2) + Fa(m - 1)
End If
End Function
Private Sub Command1_Click()
Dim a As Integer
a = 1
Do While Fa(a) < 5000
Print Fa(a)
a = a + 1
Loop
End Sub
第3个回答  2008-05-31
dfkjmg g fl kjgl;fjkg
第4个回答  2008-05-31
第一题没有意思。
我只编了超过100的,还只编到了一元面值,的其它的自己可以编的

Private Sub Command1_Click()
Dim i As Single
Dim j As Single
Dim m, n, n1, m2 As Integer
Call jisuan
End Sub
相似回答