网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)
单选题
有以下程序:#include main(){ int x[3][3]={{2},{4},{6}},i,*q=&x[0][0]; for(i=0;i {  if(i==0)   x[i][i+1]=*q+1;  else   ++q;  printf("%d",*q); } printf("");}程序的运行结果是(  )。
A

23

B

26

C

33

D

36


参考答案

参考解析
解析:
题中把数组首元素地址赋值给指针变量q,在for循环体内,当i=0时,满足if语句,把指针q指向的存储单元的值加1,即将3赋给x[0][1],接着输出q指针指向存储单元的值2;i=i+1后再次进人循环体,此时i不等于0,指针q地址加1,指向x[0][1],此时*q=3,因此最后函数输出的分别是2和3。答案选择A选项。
更多 “单选题有以下程序:#include main(){ int x[3][3]={{2},{4},{6}},i,*q=x[0][0]; for(i=0;i {  if(i==0)   x[i][i+1]=*q+1;  else   ++q;  printf("%d",*q); } printf("");}程序的运行结果是(  )。A 23B 26C 33D 36” 相关考题
考题 有以下程序:void f(int *x,int *y){ int *t; t=x; x=y ;y=t; *x=*y;}main(){ int a[8]={1,2,3,4,5,6,7,8},i,*p,*q; p=a;q=a[7]; while(pq) { f(p,q);p++;q--} for(i=0;i8;i++)printf("d,",a[i]);}程序运行后的输出结果是( )。A.8,2,3,4,5,6,7,1,B.5,6,7,8,1,2,3,4,C.1,2,3,4,5,6,7,8,D.8,7,6,5,4,3,2,1,

考题 以下程序的执行结果是【】。 include int f(int b[],int n) { int i,r=1; for(i=0;i 以下程序的执行结果是【 】。include<iostream.h>int f(int b[],int n){int i,r=1;for(i=0;i<n;i++)r=r*b[i];return r;}void main(){int x,a[]={2,3,4,5,6,7,8,9};x=f(a,3);cout<<x<<endl;}

考题 下列程序的输出结果是()。includevoid main(){char*str=”12123434”;int x1=0,x2=0,x 下列程序的输出结果是( )。 #include<iostream.h> void main() {char*str=”12123434”; int x1=0,x2=0,x3=0,x4=0,i; for(i=0;str[i]!=’\0’;i++) switch(str[i]) {case’1’:x4++; case’2’:x3++; case’3’:x2++; case’4’:xl++; ) cout<<xl<<“,”<<x2<<A.8,6,4,1B.8,6,3,2C.8,8,4,lD.8,6,4,2

考题 有以下程序:include main() {int a[] = {2,4,6,8,10} ,y =0,x, * p;p =a[1];for( 有以下程序: #include <stdio.h> main() { int a[] = {2,4,6,8,10} ,y =0,x, * p; p =a[1]; for(x=1;x<3;x++)y+ =p[x]; printf( "% d \n" , y); }程序运行后的输出结果是( )。A.10B.11C.14D.15

考题 有以下程序:include void sum(int *a){a[0]=a[1];}main(){int aa[10]={1,2,3,4,5,6,7, 有以下程序: #include <stdio.h> void sum(int *a) { a[0]=a[1]; } main() { int aa[10]={1,2,3,4,5,6,7,8,9,10},i; for(i=2;i>=0;i--) sum(aa[i]); printf("%d\n",aa[0]); } 执行后的输出结果是( )。A.4B.3C.2D.1

考题 以下程序的输出结果是includevoid main( ){int i,j,x=0;for(i=0;i 以下程序的输出结果是 #include<iostream.h> void main( ) {int i,j,x=0; for(i=0;i<2;i++) { x++; for(j=0;j<3;j++) { if(j%2)continue; x++;} x++;} cout<< "x="<<x;}A.x=4B.x=8C.x=6D.x=12

考题 有以下程序: include main ( ){int x[ ] = {1,3,5,7,2,4,6,0} ,i,j,k;for(i =0;i 有以下程序: #include <stdio. h> main ( ) { int x[ ] = {1,3,5,7,2,4,6,0} ,i,j,k; for(i =0;i<3;i ++ ) for (j =2;j> = i;j — ) if( x[j + 1 ] > x[j] ) { k = x[j] ;x[j] = x[j + 1 ] ;x[j + 1 ] = k; } for (i =0;i<3;i++) for(j =4;j <7-i;j ++) if(x[j] >x[j+1]){ k=x[j];x[j] =x[j+1];x[j+1] =k;} for (i=0;i<8;i ++) printf("%d" ,x[i]); prinff("\n" );}程序运行后的输出结果是( )。A.75310246B.1234567C.76310462D.13570246

考题 请选出以下程序的输出结果includemain(){ int a[]={1,2,3,4},i;int x=0;for(i=0;i 请选出以下程序的输出结果 #include<stdio.h> main() { int a[]={1,2,3,4},i; int x=0; for(i=0;i<4;i++) { sub(a,x);printf("%d",x);} printf("\n");} sub(s,y) int*s,y; { static int t=3; y=s[t];t--; }A.1 2 3 4B.4 3 2 1C.0D.4444

考题 有以下程序:include void fun(iht * a,int i,int j){int t;if(i 有以下程序:#include <stdio, h>void fun(iht * a,int i,int j){ int t; if(i < j) { t=a[i];a[i] =a[j] ;a[j]=t; i++;j--; fun(a,i,j);main ( ) int x[ ]: {2,6,1,8} ,i; fun(x,0,3); for( i=0;i <4;i ++ ) printf( "%2d" ,x[i] ); printf(" \n");A.1268B.8621C.8162D.8612

考题 有以下程序 include define N 4 void fun(int a[][N],int b[]) { int 有以下程序 #include <stdio.h> #define N 4 void fun(int a[][N],int b[]) { int i; for(i=0;i<N;i++) b[i]=a[i][i]; } main() {int x[][N]={{1,2,3},{4},{5,6,7,8},{9,10} },Y[N],i; fun(x,y); for(i=0;i<N;i++) printf("%d,",y[i]); printf("\n"); } 程序的运行结果是______。A.1,2,3,4,B.1,0,7,0,C.1,4,5,9,D.3,4,8,10,

考题 有以下程序 void f(int *x,int *y) { int t; t=*X; *X=*y; *y=t; } main() { int a[8]={1,2,3,4,5,6,7,8},i,*p,*q; p=a; q=a[7); while(p>q) { f(p,q); p++; q--; } for(i=0; i<8; i++) printf("%d,",a[i]); } 程序运行后的输出结果是A.8,2,3,4,5,6,7,1,B.5,6,7,8,1,2,3,4,C.1,2,3,4,5,6,7,8,D.8,7,6,5,4,3,2,1,

考题 有以下程序: void f(int*x,int*y) { int t; t=*x;*x=*y;*y=t; } main() { int a [8]={1, 2,3,4,5, 6, 7,8},i,*p,*q; p=a;q=a[7]; while(p<q) {f(p,q);p++;q-;} for(i=0;i<8;i++)printf("%d,"a[i]); } 程序运行后的输出结果是 ______。A.823,4,5,6,7,1,B.5,6,7,8,12,3,4,C.1,2,3,4,5,6,7,8,D.8,7,6,5,4,3,2,1,

考题 有以下程序: include using namespace std; int main() {int x;for(int i=1;i 有以下程序: #include <iostream> using namespace std; int main() { int x; for(int i=1;i<=100;i++) { x=i; if (++x%2==0) if (++x%3==0) if (++x%7==0) cout<A.39,81B.42,84C.26,68D.28,70

考题 下列程序的输出结果是includevoid main( ){char*str="12123434";int xl=0,x2=0,x3= 下列程序的输出结果是 #include<iostream.h> void main( ) {char*str="12123434"; int xl=0,x2=0,x3=0,x4=0,i; for(i=0;str[i]!='\0';i++) switch(str[i]) {case'1':x4++; case'2':x3++; case'3':x2++; case'4':x1++; } cout<<x1<<","<<x2<<","<<x3<<","<<x4; }A.8,6,4,1B.8,6,3,2C.8,8,4,1D.8,6,4,2

考题 有以下程序:includedefine N 8void fun(int*x,int i){*x=*(x+i)+1;}main(){int a[N]= 有以下程序: #include<stdio.h> #define N 8 void fun(int*x,int i) {*x=*(x+i)+1;} main() {int a[N]={1,2,3,4,5,6,7,8},i; fun(a,2); for(i=0;i<N/2;i++) {printf("%d",a[i]);} printf("\n"); } 程序运行后的输出结果是( )。A.1 3 1 3B.3 2 3 4C.4 2 3 4D.1 2 3 4

考题 有以下程序: voidf(int*x,int * y) { int t; t= *x;*x= *y;*y=t; } main() { inta[8]={1,2,3,4,5,6,7,8},i,*p,*q; p=a;q=a[7]; while(p) { f(p,q);p++;q--;} for(i=0;i<8;i++)printf("%d,",a[i]); } 程序运行后的输出结果是______;A.8,2,3,4,5,6,7,1,B.5,6,7,8,1,2,3,4,C.1,2,3,4,5,6,7,8,D.8,7,6,5,4,3,2,1,

考题 有以下程序:inelude main( ){int i,j,x=0;for(i=0;i 有以下程序:#inelude <stdio.h>main( ){ int i,j,x=0; for(i=0;i<2;i++ ) { x++; for(j=0;j<=3;j ++) { fi(j%2) continue; x++; x++; } pfinff( "x = % d\n",x);} 程序执行后的输出结果是( )。A.x=4B.x=8C.x=6D.x=12

考题 以下程序的输出的结果是()。include int x=3;void main(){void incre();int i;for ( 以下程序的输出的结果是( )。#include <iostream.h>int x=3;void main(){ void incre(); int i; for (i=1;i<x;i++) incre();}Void incre(){ static int x=1; x*=x+1; cout<<x<<"";}A.3 3B.2 2C.2 6D.2 5

考题 有以下程序 void f(int*x,int*y) { int t; t=*x;*x=*y;*y=t; } main() { int a[8]={1,2,3,4,5,6,7,8},i,*p,*q; p=a;q=a[7]; while(p { f(p,q);p++; q--; } for (i=0;i<8;i++)printf("%d,",a[i]); } 程序运行后的输出结果是______。A.8,2,3,4,5,6,7,1,B.5,6,7,8,1,2,3,4,C.1,2,3,4,5,6,7,8,D.8,7,6,5,4,3,2,1,

考题 有以下程序: #include #define N 4 void fun(int a[ ][N],int b[ ]) { int i; for(i=0;i main( ) { int i,j,x=0; for(i=0;iA.x=4B.x=6C.x=8D.x=12

考题 以下程序的输出结果是()。includevoid main(){int i,j,x=0;fof(i=0;i 以下程序的输出结果是( )。 #include<iostream.h> void main() {int i,j,x=0; fof(i=0;i<2;i++= {x++; for(j=0:j<3;j++= {if(j%2)continue; x++; x++;} cout<<"x="<<X;=A.x=4B.x=8C.x=6D.x=12

考题 有以下程序:include void f(int * x,int * y) int t;t= *x; *x= *y; *y=t;main ( ){in 有以下程序:#include <stdio.h>void f(int * x,int * y) int t; t= *x; *x= *y; *y=t;main ( ){ int a[8] = { 1,2,3,4,5,6,7,8} ,i, * p, * q; p=a;q =a[7]; while(p<q) { f(p,q) ;p ++ ;q --; } for(i =0;i<8;i ++ ) printf(" % d," ,a[i]); }程序运行后的输出结果是( )。A.8,2,3,4.,5,6,7,1,B.5,6,7,8,1,2,3,4,C.1,2,3,4,5,6,7,8,D.8,7,6,5,4,3,2,1,

考题 以下程序的执行结果是______ include int f(int b[],int n) { int i,r=l; for(i=0; 以下程序的执行结果是______include<iostrearn.h>int f(int b[],int n){int i,r=l;for(i=0;i<n;i++)r=r*b[i];return r;}void main(){int x,a[]= {2,3,4,5,6,7,8,9};x=f(a,3):cout<<x<<endl;}

考题 单选题有以下程序#include main(){ int x[3][2]={0},i; for(i=0;i printf("%3d%3d%3d",x[0][0],x[0][1],x[1][0]);}若运行时输入:2 4 6,则输出结果为(  )。A 2 0 4B 2 0 0C 2 4 0D 2 4 6

考题 单选题有以下程序:#include #include main(){ int i,j,x = 0; for(i = 0;i 2;i++) {  x++;  for(j = 0;j = 3;j++)  {   if(j%2==0)continue;   x++;  }  x++; } printf(x = %d,x);}程序的运行结果是(  )。A x=4B x=6C x=8D x=12

考题 单选题有以下程序:#include #include main(){ int i,j,x = 0; for(i = 0;i 2;i++) {  x++;  for(j = 0;j = 3;j++)  {   if(j%2)continue;   x++;  }  x++; } printf(x = %d,x);}程序的运行结果是(  )。A x=8B x=4C x=6D x=12

考题 单选题有以下程序:#include #define N 8void fun(int *x,int i){ *x=*(x+i);}main(){ int a[N]={1,2,3,4,5,6,7,8},i; fun(a,2); for(i=0;i {  printf("%d,",a[i]); } printf("");}程序运行后的输出结果是(  )。A 1,3,1,3,B 2,2,3,4,C 3,2,3,4,D 1,2,3,4,