怎么编程,题目都已经说明的很清楚了,你只要对照填写代码就可以了。
我给你做个第一题:
在窗体上放置一个命令按钮,两个文本框,拷贝下面代码,就可以运行了。打印代码只是为了看看f(n)的值。
Private Sub Command1_Click()
Dim f(30) As Long
Dim Max As Long, Sum As Long, n As Integer
f(0) = 1: f(1) = 2: f(2) = 3
Sum = f(0) + f(1) + f(2)
Max = f(2)
For n = 3 To 30
f(n) = f(n - 1) + 2 * f(n - 2) - 5 * f(n - 3)
Sum = Sum + f(n)
If f(n) > Max Then Max = f(n)
Print "f("; n; ")="; f(n)
'这里只是看看f(n)的值
Next
Text1.Text = Sum
'总和
Text2.Text = Max
'最大值
End Sub