计算π的程序VB,π=2*
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/13 08:32:51
privatesubform_click()dimnaslong,snaslongn=inputbox("请输入n")fori=0tonsn=sn+2*i+1nextmsgbox"1+3+5+...(
OptionExplicitPrivateSubCommand1_Click()Label1.Visible=TrueDimrAs__single___Dim____s___AsDouble_cons
4个text1-text4,Label1(0-3).PrivateSubCommand1_Click()Dimk1AsSingle,k2AsSingle,k3AsSingle,k4AsSinglek1
PrivateSubCommand1_Click()Dima,xAsSinglea=Val(Text1.Text)Ifa再问:x=x+a*0.2+3000*0.2怎么都乘0.2呀?
把变量的取值范围贴出来.再问:求公式p=v*Z*F(s,x,y)/I。其他的一样求,其中F(s,x,y)=π/M,M=ln[2ch(πs/2y)]+ln{[shπ(x/y-s/2y)*shπ(x/y+
你给的公式不对!应该是π/2=2^2/1*3×4^2/3*5×.×(这个公式求的精度不高!代码如下:DimPI1AsDoubleDimPI2AsDoubleDimTempAsDoubleDimnAsD
PrivateSubCommand1_click()DimnAsIntegern=100Printf(n)EndSubFunctionf(n)Fori=1Tonf=f+1/iNextiEndFunct
PrivateSubCommand1_Click()DimiAsInteger,jAsInteger,sumAsLong,taAsLongta=1Fori=5To10Step5Forj=2Toita=
阶乘n!=n*(n-1)(n-2)(n-2)···3*2*1
PrivateSubCommand1_Click()DimsAsString,nAsInteger,iAsIntegerFori=1To100n=n+iNextiPrint"1+2+3+……+100=
PrivateSubCommand1_Click()Text3.Text=3.14*(Val(Text1.Text)^2-Val(Text2.Text)^2)EndSub再问:能具体一点吗再答:上面就
PrivateSubCommand1_Click()DimiAsDoubleDimnAsDoubleDimsumAsDoublesum=0IfNotIsNumeric(Text1.Text)Then'
elseif连起来就行了PrivateSubCommand1_Click()DimaAsSingle,bAsSingle,cAsSingle,dAsSinglea=Val(Text1.Text)b=V
PrivateSubCommand2_Click()DimIAsLong,SAsLongForI=1To100IfIMod2=0ThenS=S-IElseS=S+IEndIfNextPrintSEnd
PrivateSubCommand1_Click()DimiAsInteger,sAsIntegers=0Fori=1To99s=s+i*(i+1)NextiDebug.Print"计算1*2+2*3
新建工程,添加command1控件.vb6.0+xp调试成功代码如下:DimnAsIntegerPrivateSubCommand1_Click()m=InputBox("请输入底数m")n=Inpu
PrivateSubForm_Click()Dimd1AsIntegerDimd2AsSingleDimd3AsIntegerDimd4AsStringDimd5AsIntegerDimd6AsInt
DimsumAsInteger,iAsIntegersum=0Fori=1To100sum=sum+iNextDebug.Print"1+2+...+100=";sum
两处错误,第一个,没有赋值过程,应该改为:a=InputBox("a=")b=InputBox("b=")c=InputBox("c=")第二个:x1=(-b-d)/(2*a)应该是x2=(-b-d)
给出代码比较简单.流程图你就根据代码来画吧sum=0fori=1to10a=1forj=1toia=a*jnextjsum=sum+anextiprintsum