• 2022-06-07
    下列程序的运行结果为 【8】 。 main() { int a[3]C4}={{1,3,5,7},{2,4,6,8},{15,17,34,12}}; printf("max value is %d\n",max value(3,4,a)); } max value(m,n,array) int m,n,array[][4]; { int i,j,max; max=array[0][0]; for(i=0;i<m;i++) for(i=0;i<n;j++) if(max<array[i][j])max=array[i][j]; return(max); }[/i][/i]
  • max value is 34

    内容

    • 0

      写出以下程序运行结果。 #include<iomanip.h> const int N=3; int main() { int a&#91;N&#93;&#91;N&#93;={{7,-5,3},{2,8,-6},{1,-4,-2}}; int b&#91;N&#93;&#91;N&#93;={{3,6,-9},{2,-8,3},{5,-2,-7}}; int i,j,c&#91;N&#93;&#91;N&#93;; for(j=0;j<N;i++) //计算矩阵C for(j=0;j<N;j++) c[i]&#91;j&#93;=a[i]&#91;j&#93;+b[i]&#91;j&#93;; for(j=0;j<N;i++) //输出矩阵C { for(j=0;j<N;j++) cout<<setw(5)<<c[i]&#91;j&#93;; cout<<endl; } }[/i][/i][/i][/i]

    • 1

      #include &#91;stdio.h&#93;int main() { int a&#91;3&#93;&#91;3&#93;,i,j; for(i=0;i<3;i++) for(j=0;j<3;j++) a[i]&#91;j&#93;=3*i+j; for(i=0;i<3;i++) printf("%d ",a[i]&#91;1&#93;); return 0;}[/i][/i]

    • 2

      写出程序的运行结果:#include <;stdio.h>;add1(int a&#91;&#93;,int n){ int i;for(i=0; i<;n; i++) a[i]++;}main(){int array&#91;&#93;={0,1,2,3,4,5,6,7,8,9};int i;add1(array,10);for (i=0; i<;10; i++)printf("%d ",array[i]);}[/i][/i]

    • 3

      以下程序的输出结果是 main() int b&#91;3&#93;&#91;3&#93;=0,1,2,O,l,2,0,1,2,i,j,t=1; for(i=0;i<3;i++) for(j=i;j<=i;j++) t=t+b[i]&#91;b&#91;j&#93;&#91;j&#93;&#93;; printf("%d\n",t);[/i] A: 3 B: 4 C: 1 D: 9

    • 4

      阅读下面程序: #include <iostream.h> void main() int i,j,row=0,column=0,m; static int a&#91;3&#93;&#91;3&#93;= 100,28,72,-30,2,-100; m=a&#91;0&#93;&#91;0&#93;; for(i=0;i<3;i++) for(j=0;j<3;j++) if (a[i]&#91;j&#93;<m) m=a[i]&#91;j&#93;; row=i; column=j; cout<<m<<","<<row<<","<<column<<endl; 该程序的功能是______,其执行结果为______。[/i][/i]