网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
5、以下程序的输出结果是 。 #include<iostream> using namespace std; void main() { int a[ ][4]={ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}; cout<<**a<<'\t'; cout<<*(a[1]+2)<<'\t'<<*(*(a+2)+2)<<'\n'; }
参考答案和解析
***** ***** ***** ***** *****
更多 “5、以下程序的输出结果是 。 #include<iostream> using namespace std; void main() { int a[ ][4]={ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}; cout<<**a<<'\t'; cout<<*(a[1]+2)<<'\t'<<*(*(a+2)+2)<<'\n'; }” 相关考题
考题
执行下面程序输出的是【】。 include using namespace std;template T tot
执行下面程序输出的是【 】。include <iostream>using namespace std;template <typename T>T total(T *data){Ts=0;while( *data) s+=*data++;return s;}int main(){int s[]={1,3,5,7,0,2,4,6,8};cout<<total(s);return 0;}
考题
有以下程序: include using namespace std; class sample {int x; public:void setx(
有以下程序:include <iostream>using namespace std;class sample{int x;public:void setx(int i){x=i;}int putx (){return x;}};int main ( ){sample *p;sample A[3];A[0] .set>:(5);A[1] .setx(6);A[2] .setx(7);for (int j=0;j<3;j++){p=A[j];cout<<p->putx () <<", ";}cout<<end1;return 0;}执行后的输出结果是【 】。
考题
在下面程序横线处填上适当内容,使得程序的输出为9876。include using namespace std;te
在下面程序横线处填上适当内容,使得程序的输出为9876。include <iostream>using namespace std;template<class T>void f(【 】){T t;for (int i=0;i<n/2;i++){t=a Ii];a [i]=a[n-1-i];a [n-1-i]=t;}}int main ( ){int x[]={6,7,8,9};f(x,4);for (int i=0;i<4;i++)cout<<x[i];cout<<end1;return 0;}
考题
程序的输出结果是【 】。 include using namespace std; class A{ int x; public: A(int
程序的输出结果是【 】。include <iostream>using namespace std;class A{int x;public:A(int x=1):x(x){cout<<x;}};void main(){A a,b(2),c(3);}
考题
下面程序的输出结果是【】。 include using namespace std; int d=1; fun(int p){ stati
下面程序的输出结果是【 】。include <iostream>using namespace std;int d=1;fun(int p){static int d = 5;d+ =p;cout<<d;return (d) ;}void main ( ) {int a =3;cout<<fun ( a + fun (d) )<<endl;}
考题
程序的输出结果是【 】。 include using namespace std; class A{ public: A(){a=b=2;}
程序的输出结果是【 】。include <iostream>using namespace std;class A{public:A(){a=b=2;}A(int i,int j){a=i;b=j;}void display(){cout<<a<<b;}private:int a,b;};void main(){A m,n(4,8);m.display();n.display();}
考题
有以下程序: include using namespace std; int main() {int a=5;b=4,c=3,d=2;if(a>b
有以下程序: #include<iostream> using namespace std; int main( ) { int a=5;b=4,c=3,d=2; if(a>b>c) cout<<d<<end1; else if((c-1:d) ==1) cout<<d+1<<end1; else cout<<d+2<<end1; return 0; } 执行后的输出结果是( )。A.2B.3C.4D.编译时有错,无结果
考题
以下程序的输出结果是【】。 include using namespace std; void fun() {static int a=0
以下程序的输出结果是【 】。include <iostream>using namespace std;void fun(){static int a=0;a+=2;cout<<a;}int main(){int CC;for(CC=1;cc<4;CC++)fun();cout<<end1;return 0;}
考题
若有以下程序: include using namespace std; template T min(T x,T y) {i
若有以下程序:include <iostream>using namespace std;template <class T>T min(T x,T y){if(x<y)return x;elsereturn y;}int main(){int n1=2,n2=10;double d1=1.5;d2=5.6;cout<<min(n1,n2)<<",";cout<<min(d2,d2)<<end1;return 0;}程序运行后的输出结果是【 】。
考题
以下程序的输出结果是 ( )。 include using namespace std; int f(int b[],int m, in
以下程序的输出结果是 ( )。 #include <iostream> using namespace std; int f(int b[],int m, int n) { int i,s = O; for(i = m;i<n;i+=2) s+=b [i]; return s; } int main ( ) { int x a[] = {1,2,3,4,5,6,7,8,9}; x = f(a,3,7); cout<<x<<end1; return 0; }A.10B.18C.8D.15
考题
有以下程序:include using namespace std;int main (){ int n; cin>>n; if (n++
有以下程序: #include <iostream> using namespace std; int main () { int n; cin>>n; if (n++<10) cout<<n<<end1; else cout<<n--<<end1; return 0; } 若执行该程序时从键盘上输入9,则输出结果是( )。A.11B.10C.9D.8
考题
下面程序的输出结果是()。includeusing namespace std;void swap(int x[2]){int t; t=
下面程序的输出结果是( )。 #include<iostream> using namespace std; void swap(int x[2]) { int t; t=x[0]; x[0]=x[1]; x[1]=t; } void main() { int a[2]={4,8}; swap(a); cout<<a[0]<<" "<<a[1]; }A.4 8B.8 4C.4 4D.8 8
考题
下面程序执行的结果是【 】。 include using namespace std; void main(){ int sum=0; i
下面程序执行的结果是【 】。include <iostream>using namespace std;void main(){int sum=0;int array[6]={1,2,3,4,5,6};int *p;p=array[0];for(int i=0;i<6;i++){sum=sum+*p;p++;}cout<<sum;}
考题
下面程序的输出结果是( )。include using namespace std;void main(){int s;for(int k
下面程序的输出结果是( )。#include <iostream>using namespace std;void main(){int s;for(int k=2;k<6;k+=2)s=1;for(int j=k; j<6;j++) s+=j;cout<<s<<end1;A.9B.1C.11D.10
考题
有以下程序,其输出结果是()。include using namespace std;int main(){ char a[10]={'
有以下程序,其输出结果是( )。 #include <iostream> using namespace std; int main(){ char a[10]={'1','2','3','4','5','6','7','8','9',0},*p; int i=8; p=a+i; cout<<p-3<<endl; return 0; }A.6789B.6C.789D.'6'
考题
给出以下程序的执行结果【】。 include using namespace std; int n=1; void Fun(); int
给出以下程序的执行结果【 】。include <iostream>using namespace std;int n=1;void Fun();int main (){n++;Fun ( );if (n>0){int n=5;cout<<"Block: n="<<n<< ", ";}cout<< "Main: n="<<end1;return 0;}void Fun ( ){int n=10;cout<<"Fun: n="<<n<<",";}
考题
下面程序的输出结果是()。includeusing namespace std;int main(){int n=10;while(n>7
下面程序的输出结果是( )。 #include<iostream> using namespace std; int main() { int n=10; while(n>7){ n--; cout<<11<<','; } cout<<endl; }A.10,9,8,B.9,8,7,C.10,9,8,7,D.9,8,7,6,
考题
有以下程序:include using namespace std;void fun(int i,int j){ cout
有以下程序: #include <iostream> using namespace std; void fun(int i,int j) { cout<<(i+j)<<end1; } void fun(int i) { cout<<i++<<end1; } int main() { int a=1; fun(A) ; return 0; } 该程序执行后的输出结果是( )。A.1B.2C.3D.4
考题
有以下程序:includeusingnamespacestd;int main (){ int a[]={1,2,3, 4,5, 6, 7,8,9,
有以下程序: #include<iostream> using namespace std; int main () { int a[]={1,2,3, 4,5, 6, 7,8,9, 10, 11, 12}; int *p=a+5, *q=0; *q=* (p+5); cout<<*p<<" "<<*q<<end1; return 0; }A.运行后报错B.66C.6 12D.5 5
考题
下面程序的输出结果是()。include using namespace std;void main( )int i,j,m=0,n=0;
下面程序的输出结果是( )。 #include <iostream> using namespace std; void main( ) int i,j,m=0,n=0; for(i=0;i<2;i++) for(j=0;j<2;j++) if(j> =i) m=1;n++; cout<<m<<endl; cout<<n;A.1 1B.1 4C.1 6D.0 2
考题
1)include2)using namespace std;3)int main()4){5)int a,b,result;6)cout
1)#include2)using namespace std;3)int main()4){5)int a,b,result;6)cout7)cin>>a>>b;8)result=3*a-2*b+1;9)cout10)}程序的第5行中的cout表示:()A、显示字符串B、标准输出的流设备C、标准输入的流设备D、程序入口
考题
下面程序的运行结果为( )。 include using namespace std; void main(){
下面程序的运行结果为( )。 #include<iostream> using namespace std; void main(){ int a=1; switch(a){ case 1:cout<<"1"; case 2:cout<<"2"; break; default:cout<<"0"; } }A.12B.120C.1D.10
考题
若有以下程序:includeusing namespace Std;int main(){ inti; inta[3][3] ={'1','2',
若有以下程序: #include <iostream> using namespace Std; int main() { int i ; int a[3] [3] = {'1','2','3','4','5','6','7','8','9'}; for(i=0;i<3;i++) cout<<a[i] [1]<<" "; cout<<end1; return 0; } 执行后的输出结果是( )。A.50 53 56B.49 52 55C.2 5 8D.1 4 7
考题
下面的程序输出的结果是( )。 include using namespace std; void main(){
下面的程序输出的结果是( )。 #include <iostream> using namespace std; void main(){ int a=2; int c=a; a++; cout<<c; }A.2B.3C.4D.*a
考题
下面程序的输出结果是()。include using namespace std;void main( ){ inta[3][3] ={{
下面程序的输出结果是( )。 #include <iostream> using namespace std; void main( ) { inta[3][3] ={{1,2},{3,4},{5}}; int s =0; for(int i=1;i<3;i++) for(int j=0;j<=i;j++) s+=a[i][j]; cout<<s<<endl;A.12B.4C.15D.13
考题
有以下程序: include using namespace std; int main() {char a[10] = {'1','2','3',
有以下程序: #include<iostream> using namespace std; int main() { char a[10] = {'1','2','3','4','5','6','7','8','9','0'),*p; int i=8; p=a+i; cout<<p-3<<end1; return 0; } 执行程序后的输出结果是( )。A.6B.6789C.'6'D.789
考题
下面程序的输出结果是()。includeusing namespace std;void main(){ int a,b; for(a=1
下面程序的输出结果是( )。 #include<iostream> using namespace std; void main() { int a,b; for(a=1,b=l;a<=100;a++) { if(b>=10) break; if(b%3= =1) { b+=3;continue; } } cout<<a; }A.101B.6C.5D.4
考题
有如下程序:includeusing namespace std;long fib(int n){ if(n>2) return(fib(n-1)+
有如下程序: #include<iostream> using namespace std; long fib(int n) { if(n>2) return(fib(n-1)+fib(n-2)); else return(n); } void main() { int i; cout<<"请输入一个整数:"; cin>>i;cout<<endl; cout<<fib(i)<<endl; { 当输入4、2时,该程序的输出结果是( )。A.5B.4C.5D.6 1 2 2 2
热门标签
最新试卷