• 2022-06-07
    【11.1.12】以下程序的输出结果为。 move(int array[6], int n, int m) {int *p, array_end; array_end=*(array+n-1); for(p=array+n-1;p>array;p--) *p=*(p-1); *array=array_end; m--; if(m>0) move (array, n, m); } main() {static int number[6]={1, 2, 3, 4, 5, 6}; int m=4, j; move(number, 6, m); for(j=0;j<5;j++) printf(“%d,”, number[j]); printf(“%d”, number[5]); }
  • 3,4,5,6,1,2

    内容

    • 0

      下面代码的输出是什么? int &#91;&#93;&#91;&#93; array = {{1, 2},{3, 4},{5,6}}; int sum = 0; for(int i = 0; i < array.length; i++) sum = sum + array[i]&#91;0&#93;; System.out.println(sum);[/i]

    • 1

      以下程序的运行结果是_______。int fun(int array&#91;3&#93;&#91;3&#93;){ int j;for(j=0;j<;3;j++) array&#91;1&#93;&#91;j&#93;++;printf("\n");}main(){ int j,a&#91;3&#93;&#91;3&#93;={0,1,2,1,0,4,2,4,5};fun(a);for(j=0;j<;3;j++)printf("%2d",a&#91;1&#93;&#91;j&#93;);printf("\n");} A: 2 1 5 B: 1 0 4 C: 0 1 2 D: 1 2 3

    • 2

      有如下程序 #include struct group { int first, second, third; }; struct group get_min_max_sum(int* array, int len) { int i; struct group res; res.first = array[0]; res.second = array[0]; res.third = array[0]; for (i=1; i res.second) res.second = array[i]; res.third += array[i]; } return res; } main() { int array[5] = {9, 1, 3, 4}; struct group res = get_min_max_sum(array, 5); printf("min=%d,max=%d,sum=%d\n", res.first, res.second, res.third); } 程序运行后的输出结果是

    • 3

      <7>/*------------------------------------------------------ 【程序改错】请在FOUND注释行下一行找出错误,并将正确写法填写到对应空格内 -------------------------------------------------------- 功能:编写程序, 求矩阵(3行3列)与5的乘积例如:输入下面的矩阵: 100 200 300 400 500 600 700 800 900 程序输出: 500 1000 1500 2000 2500 3000 3500 4000 4500 ------------------------------------------------------*/ #include void fun(int array[3][3]) { /**********FOUND**********/ int i;j; /**********FOUND**********/ for(i=1; i < 3; i++) for(j=0; j < 3; j++) /**********FOUND**********/ array[i][j]=array[i][j]/5; } main() { int i,j; int array[3][3]={{100,200,300}, {400,500,600}, {700,800,900}}; for (i=0; i < 3; i++) { for (j=0; j < 3; j++) printf("%7d",array[i][j]); printf(" "); } fun(array); printf("Converted array: "); for (i=0; i < 3; i++) { for (j=0; j < 3; j++) printf("%7d",array[i][j]); printf(" "); } }

    • 4

      存在多维数组arr,arr =np.array(&#91;&#91;1 2 3&#93; &#91;4 5 6&#93; &#91;7 8 9&#93;&#93;)数组arr.T的输出为 A: array([[1, 4, 7], [2, 5, 8], [3, 6, 9]]) B: array([[1, 2, 3], [4, 5, 8], [7, 6, 9]]) C: array([[1, 4, 7], [2, 5, 6], [3, 8, 9]]) D: array([[9, 4, 7], [2, 5, 8], [3, 6, 1]])