下列程序执行后的输出结果是 void func1(int i); void func2(int i); char st[]="hello,friend!"; void func1(int i) { printf("%c",st[i]); if(i<3) {i+=2; func2(i); } } void func2(int i) { printf("%c",st[i]); if(i<3) {i+=2;func1(i);} } main() { int i=0; func1(i); }A.helloB.helC.hloD.hlm

下列程序执行后的输出结果是 void func1(int i); void func2(int i); char st[]="hello,friend!"; void func1(int i) { printf("%c",st[i]); if(i<3) {i+=2; func2(i); } } void func2(int i) { printf("%c",st[i]); if(i<3) {i+=2;func1(i);} } main() { int i=0; func1(i); }

A.hello

B.hel

C.hlo

D.hlm


参考答案和解析
C 解析:函数调用的一般形式为:函数名(实参列表)首先调用函数funcl(0),输出st[0]=h。i值变为2,并调用函数func2(2),输出st[2]=l。i值此时变为4,又调用函数funcl(4),输出st[4]=0。此时i值大于等于3,执行完毕。因此,输出结果为hlo。注意:函数调用的一般格式以及函数的返回值。

相关考题:

下列程序执行后的输出结果是void func1(int i);void func2(int i);char st[]="hello,friend!";void func1(int i){ printf("%c",st[i]);if(i3){i+=2;func2(i);}}void func2(int i){ printf("%c",st[i]);if(i3){i+=2;func1(i);}}main(){ int i=0; func1(i); printf("\n");}A.helloB.helC.hloD.hlm

有以下程序:void main(){int t=1,i=5; for( ;i=0;) i--;t*=i; printf("%d\n",t);}执行后输出结果是。

下列程序执行后的输出结果是void funcl(int i);void func2(int i);char st[]="hello,friend!";void fund(int i){ cout<<st[i];if(i<3){i+=2;func2(i);}}void func2(int i){ cout<<st[i];if(i<3){i+=2;funcl(i);}}main( ){int i=0;fund(i);cout<<endl;}A.helloB.helC.hloD.hlm

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

下列程序执行后的输出结果是______。A.helloB.helC.hloD.hlm void func1 (int i); void func2 (int i); char st[]="hello,friend!"; void func1(int i) { printf("%c",st[i]); if(i<3){ i+=2;func2(i); } } void func2 (int i) { printf("%c",st[i]); if(i<3){ i+=2;func1(i); } } main() { int i=0;func1(i);printf("\n");}

下列程序执行后的输出结果是 void funcl(int i); void func2(int i); char st[]="hello,friend!"; void funcl(int i) {printf("%c",st[i]); if(i<3){i+=2;func2(i);}} void func2(int i) { printf("%c",st[i]); if(i<3){i+=2;func1(i);}} main() {int i=A.helloB.helC.hloD.hlm

有以下程序: void fun(int *a,int i,int i) { int t; if(i<j) { t==a[i];a[i]=a[j];a[i]=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 void main( ) {int a[3],i,j,k=2; for(i= 下列程序的输出结果是 #include<iostream.h> void main( ) { int a[3],i,j,k=2; for(i=0;i<3;i++)a[i]=i; for(i=0;i<k;i++) for(j=0;j<k;j++) a[j]=a[i]; cout<<a[2];}A.2B.3C.1D.0

以下程序运行后的输出结果是()。includevoid reverse(int a[],int n){int i,t;for(i=0; 以下程序运行后的输出结果是( )。 #include<stdio.h> void reverse(int a[],int n) {int i,t; for(i=0;i<n/2;i++) {t==a[i];a[i]=a[n-1-i];a[n-1-i]=t;} } main() {int b[10]={10,9,8,7,6,5,4,3,2,1};int i,s=0; reverse(b,10); for(i=0;i<3;i++)s+=b[i]; printf("%d\n",s); }A.27B.6C.25D.30

有如下程序void func1(int st[],int i){ printf("%c",st[i]); if(i}void func2(int st[],int i){ printf("%c",st[i]); if(i}main(){ char st[ ]="hello,friend! "; int i=0;func1(st,i); printf("\n");}程序执行后输出的结果是A.hello B.hel C.hlo D.编译出错

下列程序执行后的输出结果是()。includevoid func1(int i);void func2(int i);char st[ 下列程序执行后的输出结果是( )。 #include<stdio.h> void func1(int i); void func2(int i); char st[]="hello,friend!"; void funcl(int i) { printf("%c",st[i]); if(i<3){i+=2;func 2(i);} } void func 2(int i) { printf("%c",st[i]); if(i<3){i+=2;funcl(i);} } main() { int i=0; funcl(i);printf("\n"); }A.helloB.helC.hloD.hlm

下面程序执行后的结果是()。includeusing namespace std;void func1(int i);void func 下面程序执行后的结果是( )。 #include<iostream> using namespace std; void func1(int i); void func2(int i); char st[]="hello, friend!"; void func1(int i) { cout<<st[i]; if(i<3){i+=2;func2(i);} } void func2(int i) { cout<<st[i]; if(i<3){i+=2;func1(i);} } void main() { int i=0;func1(i);cout<<endl;}A.elloB.helC.hloD.him

下列程序执行后的输出结果是( )。 void func1 (int i); void func2(int i); char st[]="hello,friend!"; void func1 (int i) { printf("%c",st[i]); if(i<3){i+=2;func2(i);} } void func2(int i) { printf("%c",st[i]); if(i<3){i+=2;func1(i);}A.helloB.helC.holD.hlm

有以下程序: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 void fun(int a, int b) {int t; t=a; a=b; 有以下程序 #include<stdio.h> void fun(int a, int b) {int t; t=a; a=b; } int c[10]={1,2,3,4,5,6,7,8,9,0},i; for(i=0;i<10;i+=2) fun(c[i],c[i+1]); for(i=0;i<10;i++) printf("%d,",c[i]); printf("\n"); } 程序的运行结果是______。A.1,2,3,4,5,6.7,8,9,0,B.2,1.4.3.6,5.8,7,0,9,C.0,9,8,7,6,5,4,3,2,1,D.0,1,2,3,4,5,6,7,8,9,

有以下程序 include void fun(int a[],int n) { int i,t; for(i=0; 有以下程序 #include <stdio.h> void fun(int a[],int n) { int i,t; for(i=0;i<n/2;i++) {t=a[i]; a[i]=a[n-1-i]; a[n-1-i]=t;} } main() {int k[10]={1,2,3,4,5,6,7,8,9,10},i; fun(k,5); for(i=2;i<8;i++) printf("%d",k[i]); printf("\n"); } 程序的运行结果是______。A.345678B.876543C.1098765D.321678

以下程序的输出结果是 include void reverse(int a[ ] ,int n) { int i,t;for(i=0 以下程序的输出结果是#include<iostream.h>void reverse(int a[ ] ,int n){ int i,t;for(i=0;i<n/2;i++){t=a[i] ;a[i] =a[n-1-i] ;a[n-1-i] =t;}}void main( ){ int b[10] ={1,2,3,4,5,6,7,8,9,10};int i,s=0;reverse(b,8) ;for(i=6;i<10;i++) s+=b[i] ;cout < < S;}A.22B.10C.34D.30

有以下程序: void fun( int *a, int i, int j) { int t; if ( i<j ) { t=a[i];a[i]=a[j];a[j]=t; fun (a,++i,--j); } } main() { int a[]={1,2,3,4,5,6),i; fun(a,0,5) for( i=0; i<6; i++) printf("%d",a[i]); } 执行后的输出结果是( )。A.654321B.432156C.456123D.123456

下列程序的输出结果是 classA{ int i,j; A(int i,int j) { this.i=i; this.j=j; } void print( ) { System.out.println("i="+i+""+"j="+j) } class B extends A{ int in; B (int i,int j,int m){ super(a,B) ; this.m=m; } void print( ) { Sytem.out.println("m+"+m);} } class C { public static void main (strang argsⅡ) { B b:new B(1,2,3); b.print( ); } }A.i=1 j=2 m=3B.m=3C.i=3 j=2D.m=1 i=1

有以下程序,程序执行后,输出结果是【】include void fun(int*A) {a[0]=a[1];} main() {i 有以下程序,程序执行后,输出结果是【 】include<stdio.h>void fun(int*A){ a[0]=a[1];}main(){ int a[10]={10,9,8,7,6,5,4,3,2,1,},i;for(i=2;i>1=0;i-) fun(a[i]);for(i=0;i<10;i++) printf("%d,a[i]);printf("\n");}

有以下程序: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

有下列程序void func1(int i);void func2(int i);char st[ ]="hello,friend! ";void func1(int i){ printf("%c",st[i]); if(i3){i+=2;func2(i);}}void func2(int i){ printf("%c",st[i]); if(i3){i+=2;func1(i);}}main(){ int i=0;func1(i); printf("\n");}执行后的输出结果是A.hello B.helC.hlo D.hlm

下列程序 void func1(int i); void func2(int i) char st[]="hello,friend!"; void funcl(int i) { printf("%c",st[i]); if(i<3){i+=2;func2(i);} } void func2(int i) { printf("%c",st[i]); if(i<3){i+=2;funcl(i);} } main() { int i=0;funcl(i);printf("\n");} 执行后的输出结果是( )A.helloB.helC.hloD.hlrn

下列程序执行后的输出结果是 void func1(int i); void func2(int i); char st[]="hello,friend!”; void func1(int i) { printf("%c",st[i]); if(i<3){i+=2;func2(i);}} void func2(int i) { printf("%c",st[i]); if(i<3){i+=2;func1(i);}} { int i=0;func1(i);printf("\n");}A.helloB.helC.hloD.hlm

以下程序输出结果是 ______。includevoid n(int i);void f2(int i);char st[]=”Howd 以下程序输出结果是 ______。 #include<iostream.h> void n(int i); void f2(int i); char st[]=”Howdoyoudo!”; void fl(int i){ cout<<st[i]; if(i<3){ i+=2: f2(i): } } void f2(int i) { cout<<st[i]; if(i<3) { i+=2; f1(i); } } void main() { int i=0; f1(i); }A.HowB.doC.HwoD.Hwoy

有以下程序 void f(int a[],int i,int j) { int t; if(i<j) { t=a[i];a[i]=a[j];a[j]=t; f(a,i+1,j-1); } } main() { int i,aa[5]={1,2,3,4,5}; f(aa,0,4); for(i=0;i<5;i++)printf("%d,",aa[i];printf("\n"); } 执行后输出结果是A.5,4,3,2,1B.5,2,3,4,1,C.1,2,3,4,5D.1,5,4,3,2,

下列程序执行后的输出结果是() voidfunc1(inti); voidfunc2(inti); charst[]="hello,friend!"; voidfunc1(inti) {printf("%c",st[i]); if(i3){i+=2;func2(i);} } voidfunc2(inti) {printf("%c",st[i]); if(i3){i+=2;func1(i);} } main() {inti=0;func1(i);printf("/n");}A、helloB、helC、hloD、hlm

单选题有以下函数:#include void func(int n){ int i; for(i=0;i=n;i++)printf(*); printf(#);}main(){ func(3); printf(????); func(4); printf();}程序运行后的输出结果是(  )。A****#????***#B***#????*****#C**#????*****#D****#????*****#