1楼:匿名用户
老实说看了半天,看不太懂这函数
public function fact(byval n as integer) as double
dim count as integer
count=2
dim a as double, b as doubledim c as double
do until false
c=(a+b)\3
if c<0.0001 then
exit do
else
count=count +1
a=bb=c
end if
loop
label1.text = count
n=count
fact=b
end function
如果要产生一个数列的 返回类型应是 数组,而不是 double
2楼:寒信
不对,不是循环的问题,你的**有问题呀,n是什么东西,一开始, b 是0 ,n也就等于0,那循环for i=3 to n 就一次也不会执行了。一开始fact是0 do untill fact <0.0001也一次不会执行,怎么那么乱呀
改这样吧
public sub fact(a as double, b as double)
dim c as double
c = (a + b) / 3
if c < 0.0001 then
label1.caption = c
exit sub
end if
fact b, c
end sub
private sub command1_click()fact 1, 2
end sub
c语言编程........有一个数列,其前三项分别为1,2,3,从第四项开始,每项均为其相邻的前三项之和的1/2
3楼:百度网友
#include
#include
using namespace std;
int main(int argc, char *argv)cout< system("pause"); return exit_success;} 4楼:百度网友 #include "stdio.h" int main() while(d3<1200); printf("%d",n);}