试题33有以下程序#include stdio.hint f(int m){ static int n=0;n+=m;return n;}main(){ int n=0;printf(“%d,”, f(++n));printf(“%d\n”, f(n++));}程序运行后的输出结果是()A.1,2B.1,1C.2,3D.3,3
试题33
有以下程序
#include <stdio.h>
int f(int m)
{ static int n=0;
n+=m;
return n;
}
main()
{ int n=0;
printf(“%d,”, f(++n));
printf(“%d\n”, f(n++));
}
程序运行后的输出结果是()
A.1,2
B.1,1
C.2,3
D.3,3
相关考题:
( 33 )有以下程序#include studio.hint f ( int t[],int n ) ;main{ int a[4]={1,2,3,4},s;s=f ( a,4 ) ; printf ( " %d\n " ,s ) ;}int f ( int t[],int n ){ if ( n0 ) return t[n-1]+f ( t,n-1 ) ;else return 0 ;}程序运行后的输出结果是A ) 4B ) 10C ) 14D ) 6
34 ) 有以下程序#include stdio.hint f(int n);main(){ int a=3,s;s=f(a);s=s+f(a);printf("%d\n",s);}int f(int n){ static int a=1;n+=a++;return n;}程序运行以后的输出结果是A)7B)8C)9D)10
阅读下面程序: include void fun(int n) { int x(5); static int y(10); if(n>0) { 阅读下面程序:include<iostream.h>void fun(int n){int x(5);static int y(10);if(n>0){++x;++y;cout<<x<<","<<y<<end1;}}void main(){int m(1);fun(m);}则该程序的输出结果是______。
阅读下面程序: include void f(int n) { int x(5); static int y(10); if(n>0) { ++ 阅读下面程序:include<iostream.h>void f(int n){int x(5);static int y(10);if(n>0){++x;++y;cout<<x<<","<<y<<endl;}}void main(){int m(1);f(m),}则该程序的输出结果是【 】
有以下程序:includedstdio.hint f(int n); main( ){int a=3,s; s=f(a);s=s+f(a);printf(int f(int n);main( ){int a=3,s;s=f(a);s=s+f(a);printf(%dkn,s);}int f(int n){static int a=1;n+=a++;return n;}程序运行后的输出结果是( )。A.7B.8C.9D.10
有以下程序:includeint a=4;int f(int n){int t=0;static int a=5;if(n%2) {int a=6; 有以下程序: #include<string.h> int a=4; int f(int n) {int t=0;static int a=5; if(n%2) {int a=6;t++=a++;} else{int a=7;t+=a++;} return t+a++; } main() {int s=a,i=0; for(;i<2;i++)s+=f(i); printf("%d\n",s); } 程序运行后的输出结果是( )。A.24B.28C.32D.36
有如下程序:includeusing namespace std;Class Test{public:Test(){n+=2;}~Test(){n- 有如下程序: #include<iostream> using namespace std; Class Test { public: Test() {n+=2;} ~Test() {n-=3;} static int getNum() {return n;} private: static int n; }; int Test::n=1; int main() { Test*p=new Test;A.n=0B.n=1C.n=2D.n=3
有如下程序: #include(iostream> using namespace std; Class Test { public: Test() {n+=2;} ~Test() {n-=3;) static int getNum() {return n;} private: static int n; }; int Test::n=1; int main() { Test*p=new Test;A.n=0B.n=1C.n=2D.n=3
阅读下列程序: include void fun(int n) { int x(5); static int y(10); if(n>0) { 阅读下列程序:include<iostream.h>void fun(int n){int x(5);static int y(10);if(n>0){++x;++y;cout<<x<<","<<y<<endl;}}void main()int m(1);fun(m);}则该程序的输出结果是______。
有如下程序: include using namespace std; class Test { public 有如下程序: #include<iostream> using namespace std; class Test { public: Test(){n+=2;} ~Test(){n-=3;} static int getNum(){return n;} private: static int n; }; int Tesl::n=1 int main() { Test*p=new Test; delete p; cout<<"n="<<Tes::tgetNum()<<endl; return 0; } 执行后的输出结果是A.n=0B.n=1C.n=2D.n=3
有以下程序 include int a=1; int f(int c) { stati 有以下程序 #include <stdio.h> int a=1; int f(int c) { static int a=2; c=c+1; return (a++) + c; } main() { int i, k=0; for(i=0;i<2;i++) { int a=3; k += f(a); k +=a; printf("%d\n",k); }A.14B.15C.16D.17
以下程序的输出结果是#include stdio.hint fun(int x){ static int m=0; return(m *=x);}main(){ int s,i; for(i=l;i=3;i++) s=fun(i); printf("%d\n",s);}
有如下程序:include usingnamespacestd:class Test{public: Test(){n+=2; ~Test(){n- 有如下程序:#include <iostream>using namespace std:class Test{public: Test() {n+=2; ~Test() {n-=3; ; static int getNum() {return n;}privaue: static int n:};int Test::n=1;int main(){ Test* p=new Test; delete p; cout<<"n="<<Test::getNum()<<end1; return 0;} 执行后的输出结果是A.n=0B.n=1C.n=2D.n=3
有以下程序 include int fun(int (*s)[4],int n,int k) {int m,i; 有以下程序 #include <stdio.h> int fun(int (*s)[4],int n,int k) {int m,i; m=s[0][kl; for(i=1;i<n;i++) if(s[i][k]>m) m=s[i][k]; return m; } main() { int a[4][4]={{1,2,3,4},{11,12,13,14}, {21,22,23,24}, {31,32,33,34}}; printf("%d\n",fun(a,4,0)); } 程序的运行结果是______。A.4B.34C.31D.32
有如下程序:include using namespace std;class Test{public:Test(){n+=2; }~Test(){ 有如下程序: #include <iostream> using namespace std; class Test { public: Test() {n+=2; } ~Test() {n-=3; } static int getNum() {return n; } private: static int n; }; int Test::n=1; int main() { Test* p=new Test; delete p; cout<<"n="<<Test::getNum()<<endl; return 0; } 执行该程序的输出结果是( )。A.n=0B.n=1C.n=2D.n=3
有以下程序#inelude(stdio.hint f(int n);main( ){int a=3,s;s=f(A);8=s+f(A);prinff(“%d\n”,s);}int f(int n){static ifit a=1:n+=a++:return n;}程序运行后的输出结果是A.7B.8C.9D.10
有下列程序: include using namespace std; classTest{ public: Test(){n+=2;} ~Test 有下列程序: #include<iostream> using namespace std; classTest{ public: Test() {n+=2;} ~Test() {n-=3;} static int getNum(){return n;} private: static int n; }; int Test::n=1; int main() { Test*p=new TestA.n=0B.n=lC.n=2D.n=3
以下程序的执行结果是 ______。 include int max(int x,int y) { ret 以下程序的执行结果是 ______。include<iostream.h>int max(int x,int y){return(x>y? x:y);}void main(){int n=2,m=10;max(n,m)--;cout<<"n="<<n<<",m="<<m<<endl;}
以下程序的输出是【】。 include using namespace std; fun(intm) { static int n=1; n=m 以下程序的输出是【 】。include<iostream>using namespace std;fun(intm){static int n=1;n=m*n;return(n);}void main(){int i;for(i=1;i<=3;i++) cout<<fun(i);}
有下列程序:includeusing namespace Std;class Test{public:Test(){n+=2;}~Test(){n- 有下列程序: #include<iostream> using namespace Std; class Test { public: Test() {n+=2;} ~Test() {n-=3;} static int getNum(){return n;} private: static int n; }; int Test∷n=1; int main()A.n=0B.n=lC.n=2D.n=3
有以下程序: #includedstdio.h int f(int n); main( ) {int a=3,s; s=f(a);s=s+f(a);printf("%dkn",s); } int f(int n) {static int a=1; n+=a++; return n; } 程序运行后的输出结果是( )。A.7B.8C.9D.10
有以下程序#includestdio.hint f(int m){ static int n=0;n+=m:return n;}main(){ int n=0;printf("%d,",f(++n));printf("%d\n",f(n++));}程序运行后的输出结果是A.1,2B.1,1C.2,3D.3,3
有以下程序: include int a =2;int f(int n){ static int a: 3;intt=0;if(n%2){ stat 有以下程序: #include <stdio, h>int a =2;int f(int n){ static int a: 3; int t=0; if(n%2){ static int a=4;t+ =a++;} else { static int a=5;t+ :a++;} return t + a + +;main ( ){ int s=a,i; for(i=0;i<3;i++)s + =f(i); prinff("% d \n" ,s); }程序运行后的输出结果是( )。A.26B.28C.29D.24
有以下程序: #includestdio.h int f(int m) { static int n=0; n+=m; return n; } main( ) { int n=0; printf("%d,"f(++n)); printf("%d\n",f(n++)); } 程序运行后的输出结果是( )。A.1,2B.1,1C.2,3D.3,3
单选题有以下程序:#include int f(int x); main(){ int n=1,m; m=f(f(f(n))); printf(%d,m); }int f(int x) { return x*2;} 程序运行后的输出结果是( )。A4B2C8D1
单选题有以下程序:#include int f(int n);main(){ int a=3,s; s=f(a); s=s+f(a); printf(%d,s);}int f(int n){ static int a=1; n+=a++; return n;}程序运行以后的输出结果是( )。A7B8C9D10
单选题有以下程序:#include int a=2; int f(){ static int n; int m; m=n=0; n++; a++; m++; return m+n+a; }main(){ int k; for(k=0;k3;k++) printf(%d, ,f()); printf(); }程序的运行结果是( )。A5,6,7,B5,7,9,C5,8,11,D5,5,5,