• 2022-06-03
    有以下程序voidfun(inta[],intn){inti,t;for(i=0;i
    A: 345678
    B: 876543
    C: 1098765
    D: 321678
  • D

    内容

    • 0

      【填空题】下面程序输出结果是28,请将程序补充完整#include<iostream.h>inta[8]={1,2,3,4,5,6,7};voidfun(int*pa,intn);intmain(){intm=8;fun(a,m);cout<<a[7]<<endl;return0;}voidfun(int*pa,intn){for(inti=0;i<n-1;i++)_________________}

    • 1

      下面程序的时间复杂度为_______。voidfun(intn){inti=1;while(i<=n)i=i*3} A: O() B: O(nlog3n) C: O(n) D: O(log3n)

    • 2

      若有定义:inti=0,x=0;inta&#91;3&#93;&#91;3&#93;={1,2,3,4,5,6,7,8,9};则以下程序段运行后x的值为()for(;i<3;i++)x+=a[i]&#91;2-i&#93;;[/i] A: 0 B: 12 C: 15 D: 18

    • 3

      voidfun(intn){ inti=l; while(i<=n) i=i*2; } A: O(n) B: O(n2) C: O(nlog2n) D: O(log2n)

    • 4

      以下不能对二维数组a进行正确初始化的语句是()。(A)inta&#91;2&#93;&#91;3&#93;={0};(B)inta&#91;&#93;&#91;3&#93;={{1,2},{0}};(C)inta&#91;2&#93;&#91;3&#93;={{1,2},{3,4},{5,6}};(D)inta&#91;&#93;&#91;3&#93;={1,2,3,4,5,6}; A: inta[2][3]={0}; B: inta[][3]={{1,2},{0}}; C: inta[2][3]={{1,2},{3,4},{5,6}}; D: inta[][3]={1,2,3,4,5,6};