vb 语言:某城市1982年开始计划生育,每年的人口减少原来的25%多1000,经过十年城市人口达到5000000
henri2003 2011-12-12 20:23
满意回答
递归吧。 private function jhsy(byval renshu as long,byval nianshu as integer) as long 'nianshu就是几年,renshu就是几年后有多少人 if nianshu=1 then jhsy=renshu else jhsy=jhsy((renshu-1000)*1.25,nianshu-1) end if end function private sub command1_click() dim renshu as long dim nianshu as integer renshu=inputbox("请输入X年后的人数") nianshu=inputbox("请输入过哑实乡了几年") msgbox "城市原有用基" & jhsy(renshu,nianshu) & "人" end sub 纯阶绣手打,你自己调试下。
宝宝知道提示您:回答为网友贡献,仅供参考。
为您推荐:
其他回答
原始人口数:88855664 这个程序是倒推比较简单 Private Sub Command1_Click() Dim x As Long x = 5000000 Dim y As Long Dim i As Integer For i = 9 To 0 Step -1 y = (x + 1000...
Function GetNum(ByVal orgNum As Integer, iYear as Integer) Dim ttt As Integer, kkk As Integer kkk = iYear ttt = orgNum While kkk > 0 ttt = (ttt - 1000...
while 循环