dim intS[5] as integer
dim i,n as integer 'n为年数n=20 for i = 1 to n next
dim i,n as integer 'n为年数n=20 for i = 1 to n next
解决方案 »
- 在线等..关于限制DataGrid某一列的输入字符的长短问题
- DataEnvironment和Data report
- 要如何把 ACCESS 数据库里的表导入SQLServer?
- 用什么办法可以得到数据文件中的表的名字
- vb操作EXCEL的问题
- 进来拿分各位兄弟(关于错误捕捉的简单问题)
- 这变量定义代表什么意思,我是初学者!!!!!
- 我现在很迷茫,学完了VB基础,要继续进阶的学,要怎么学
- 怎样使程序结束时自动删除自己?
- VB中,picture控件能否象text控件那样用滚动条延伸?
- 引用外部对象(只要一句话就能的分)
- 我是vb初手,如何响应系统的特定消息,如系统菜单中自添加的菜单项的单击消息?
dim intS[5] as integer
dim i,n,x as integer 'n为年数
dim intTotal as integer '牛的总数
n=20
intS[1]=1
for i = 1 to 5
intS[i]=0
next
for i = 1 to n
intS[0]=intS[0]+intS[5]
intS[5]=intS[4]
intS[4]=intS[3]
intS[3]=intS[2]
intS[2]=intS[1]
intS[1]=intS[0]
next
intTotal=0
for i=0 to 5
intTotal=intTotal+intS[i]
next
第一次长度为一,其值为5(大于4即可)
for i=1 to 20
begin
1:依次判断数组的值,若大于4,则数组长度加一,新值为0(牛的年龄)
2:数组值全部加一
end
数组长度=牛数量
Dim t As Integer
Dim i As Integer
n(4) = 1
For i = 1 To 20
t = n(4)
n(4) = n(4) + n(3)
n(3) = n(2)
n(2) = n(1)
n(1) = t
Next
Debug.Print n(1) + n(2) + n(3) + n(4)
'907
Dim oldCow As Integer
Dim oneCow As Integer
Dim twoCow As Integer
Dim threeCow As Integer
Dim fourCow As Integer
Dim n As Integer
Dim temp As Integer
Dim i As Integer
n = years
oldCow = oldcows
For i = 1 To n
temp = oldCow
oldCow = oldCow + fourCow
fourCow = threeCow
threeCow = twoCow
twoCow = oneCow
oneCow = temp
Print "µÚ" & i & "Ä꣺" & oldCow + oneCow + twoCow + threeCow + fourCow
Next
HowManyCow = oldCow + oneCow + twoCow + threeCow + fourCow
End Function
s = 1
For i = 1 To n - 4
s = s + i
If i - 4 > 0 Then
For j = 1 To i - 4
s = s + j
Next
End If
Next
s = s + n
MsgBox s + n
n = 50
s = 1
For i = 1 To n - 4
s = s + i
If i - 4 > 0 Then
For j = 1 To i - 4
s = s + j
Next
End If
Next
s = s + n
MsgBox s + n
sum=n*x
for i=1 to ((n div 4)-1)
sum=sum +(n-4)*xnext i
n为年数,sum为牛数,x为一头牛的生育能力,即一年生几头牛
sum=n*x
for i=1 to int((n-1) / 4))
sum=sum +(n-4)*xnext i
Private Sub Command1_Click()
Dim CowOldSum As Integer '年数
Dim CowCount As Integer '纪录牛总数
CowCount = 0
If Text1.Text >= 4 Then
For CowOldSum = Text1.Text To 1 Step -3
Call aa(CowOldSum)
CowCount = count1 + CowCount
Next CowOldSum
If ((Text1.Text - 4) Mod 3 = 0) Then
CowCount = CowCount + Text1.Text
Else
CowCount = CowCount + Text1.Text + 1
End If
Else
For CowOldSum = Text1.Text To 1 Step -1
CowCount = CowCount + 1
Next CowOldSum
CowCount = CowCount + 1
End If
MsgBox CowCount
End Sub
Public Sub aa(cnt As Integer) count1 = (cnt - 3 + 1) * (cnt - 3) / 2End Sub