Loop pd=True End Function
4.执行下面程序,单击命令按钮CmdRun后,图片框Pic1第一行显示内容是___(10)___,第二
行显示内容是___(11)___,最后一行显示内容是___(12)___。 Option Explicit
Private Sub CmdRun_Click() Dim N As Integer,M As Integer M=135 N=8
Pic1.Print Fun(M,N) EndSub
Private Function Fun(ByVal N As Integer,ByVal R As Integer)As String
Dim L As Integer If N End If Pic1.Print N End Function 5.执行下面程序,单击命令按钮CmdRun后,文本框Text1中第一行显示的内容是___(13)___ , 第二行显示的内容是___(14)___。第三行显示的内容是___(15)___ 。 Option Explicit Private Sub CmdRun_Click() Dim S As String,Subs As String,P As Integer S=\ Do P=InStr(S,\ If P<>0 Then Subs=Left(S,P-1) Else Subs=S End If S=Mid(S,P+1) Text1=Text1 & Complement(Subs) & vbCrLf Loop Until Len(S)=0 Or P=0 End Sub Private Function Complement(S As String)As Integer Dim P As Integer,L As Integer L=Len(S) If Left(S,1)=1 Then Complement=-32 End If P=1 Do Until P=0 P=InStr(P+1,S,\ If P<>0 Then Complement=Complement+2^(L-P) End If Loop End Function 6.本程序的功能是按公式求S的近似值(计算到第n项的绝对值小于等于10^-7为止)。 S=x- + * +(-1) * 请完善本程序。 Option Explicit Private Sub Command1_Click() Dim x As Single,n As Single,T As Single,S As Single x=Val(Text1) S=x Do ___(16)___ T=afun(x,n) S=S+T Loop Until ___(17)___ Text2=Format(S,\ End SUb Private Function afun(x As Single,n As Single)As Single Dim i As Single,p As Single P=1 For i=1 To n p= ___(18)___ Next i afun=(-1)^n*p*x^(2*n+1)/(2*n+1) End Function 7.本程序的功能是找出10到60之间所有不可以表示成两个平方数之和的数,请完善本程序• Option Explicit Private Sub CmdFind_Click() Dim i As Integer,j As Integer,k As Integer Dim p As Integer,q As Integer For i=10 To 60 For j=1 To Int(Sqr(i)) ___(19)___ q=i-P If q<>0 And judge(q) Then Exit For Next j If ___(20)___ Then k=k+1 Text1.Text=Text1.Text & i & \ \ If k Mod 5=0 Then Text1.Text=Text1.Text & vbCrlf End If Next i EndSub Public Function judge(ByVal x As Integer)As Boolean If ___(21)___ Then judge=True Else judge=False End If End Function 8.本程序的功能是:找出所有满足各位数字之和正好是其所有质因子之和的三位数。例如378,其各 位数字之和为18,而其质因子2,3,3,3,7之和也是18,所以378是 百度搜索“70edu”或“70教育网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,70教育网,提供经典综合文库2024年秋江苏省计算机二级VB考试笔试真题在线全文阅读。
相关推荐: