有如下函数过程: Function lj(x As Integer) As Long Dim s As Long Dim i As Integer s=0 For i = 1 To x s=s+ i Next i 1j= s End Function在窗体上添加一个命令按钮,名为Command1, 编写事件过程调用该函数: Private Sub Command1 Click() Dim i As Integer Dim sum As Long For i = 1 To 5 sum = sum + 1j(i) Next i Print sum End SubA. 25B.35C.45D.55

有如下函数过程: Function lj(x As Integer) As Long Dim s As Long Dim i As Integer s=0 For i = 1 To x s=s+ i Next i 1j= s End Function在窗体上添加一个命令按钮,名为Command1, 编写事件过程调用该函数: Private Sub Command1 Click() Dim i As Integer Dim sum As Long For i = 1 To 5 sum = sum + 1j(i) Next i Print sum End Sub

A. 25

B.35

C.45

D.55


相关考题:

( 35 )有如下程序::#includeusing namespace std:class Sample{friend long fun ( Sample s ) ;public:Sample ( long a ) {x=a;}Private:long x;};long fun ( Sample s ){if ( s.x2 ) retum 1;retum s.x*fun ( Sample ( s.x-a ))}int main (){int sum=0for ( int i =0; i 6; i ++ ) { sum+=fun ( Sample ( i ) ; ) }coutSUM;retum 0;}运行时输出的结果是A ) 120B ) 16C ) 154D ) 34

include void main() int s=0 for(int i=l;i #includevoid main()int s=0for(int i=l;is十=i*icout}输出结果:

以下fun函数的功能是:找出具有N个元素的一维数组中的最小值,并作为函数值返回,请填空。(设N己定义)int fun(int x[N]){int i,k=0for(i=0;iN;i++)if(x[i]x[k])k=_____;return x[k];}

有如下程序 gincludevoid main(){char ch[2] [5]={”6937","8254"),*p[2];int i,j,S 有如下程序 #ginclude<iostream.h> void main() {char ch[2] [5]={”6937","8254"),*p[2]; int i,j,S=0 for(i=0;i<2:i++)p[i]=ch[i]; for(i=0;i<2:i++) for(j=0;p[i] [j]>'\0';j+=2) s=10*s+p[i] [j]-'0': cout<<s;} 该程序的输出结果是( )。A.69825B.63825C.6385D.693825

链表的定位函数loc(I:integer):pointer; {寻找链表中的第I个结点的指针}procedure loc(L:linklist; I:integer):pointer;var p:pointer;j:integer;

以下sum函数的功能是计算下列级数之和:请给函数中的各变量正确赋初值。double sum(douLle x,int n){ int i;double a,b,s;【 】for(i=1;i<=n;i++) {a=a*x;b=b*i;s=s+a/b;}return s;}

阅读以下函数说明和C语言函数,将应填入(n)处的字句写在对应栏内。【函数2.1】void sort(char *s,int num){int i,j--num;char t;while(j-->1)for(i=0;i<j;i++)if(s[i]>s[i+1]){t=s[i];s[i]=s[i+1];s[i+1]=t;}void main(){char *s="CEAedea";sort(s,5);printf("%s",s);}上述程序的结果是(1)【函数2.2】void main(){ union {int ig[6];Char s[12];} try;try. ig[0]=0x4542; try.ig[1]=0x2049;try. ig[2]=0x494a; try.ig[3]=0x474e;try. ig[4]=0x0a21; try.ig[5]=0x0000;pintf("%s",try, s);}上述程序的结果是(2)【函数2.3】void main(){ char *letter[5]= { "ab","efgh","ijk","nmop","st"};char **p;int i;p=letter;for(i=0;i<4;i++) .printf("%s",p[i]);}上述程序的结果是(3)【函数2.4】main(){int i=4,j=6,k=8,*p=I,*q=j,*r=k;int x,y,z;x=p==i;y=3*-*p/(*q)+7;z=*(r=k)=*p**q;printf("x=%d,y=%d,z=%d",x,y,z);}上述程序的结果是(4)【函数2.5】int a[]={5,4,3,2,1 };void main(){int i;int f=a[0];int x=2;for(i=0;i<5;i++)f+=f*x+a[i];printf("%d",f);}上述程序的结果是(5)

编写如下事件过程: Option Base 1 Private Sub Form Click() Dim x1()As Integer Dim i As Integer Dim s As Integer ReDim x1(3) For i = 1 To UBound(x1) x1(i)=i + 1 Next i Call sub1(x1) For i = 1 To UBound(x1) s = s + x1(i) Next i Print s End Sub Private Sub sub1(n()As Integer) Dim i As Integer ReDim Preserve n(5) For i = 3 To 5 n(i)=n(i-1)*2 Next i End Sub 程序运行后,单击窗体,则窗体上显示的内容是A.6B.12C.24D.47

有以下程序 main () { int aa[4][4]={{1,2,3,4} {5,6,7,8},{3,9.10,2},{4,2,9,6}}; int i. s=0 for(i=0;i<4;i++) s+=aa[i] [1]; printf ( "%d\n", s); } 程序运行后的输出结果是A.11B.19C.13D.20

8、下列程序中,哪一行语句有错误 。 1 PROGRAM P01 2 INTEGER:: I,S=0 3 DO I=10,1,-2 4 I=I*I 5 S=S+I 6 ENDDO 7 END PROGRAMA.2B.3C.4D.7