有如下程序 int a[10]={1,2,3,4,5,6,7,8,9,10}; int *p=&a[3],b;b=p[5]; 则b的值是
A.5
B.6
C.9
D.8
A.5
B.6
C.9
D.8
有如下程序: main() { int a[3][3]={{1,2},{3,4},{5,6}},i,j,s=0; for(i=1;i<3;i++) for(j=0;j<=i;j++) s+=a[i][j]; printf("%d\n",s); } 该程序的输出结果是______。
A.18
B.19
C.20
D.21
A.print1
B.print2
C.print1 print2
D.程序编译时出错
有如下程序: #include<iostream> using namespace std; class sample { private: int x,y; public: sample(int i,int j) { x=i; y=j; } void disp() { cout<<"disp1"<<end1; } void disp()const { cout<<"disp2"<<end1; } }; int main() { const sample a(1,2); a.disp(); return 0; } 该程序运行后的输出结果是
A.disp1
B.disp2
C.disp1 disp2
D.程序编译时出错
有如下程序: #include <iostream> using namespace std; class sample { private: int x,y; public: sample(int i,int j) { x=i; y=j; } void disp () { cout<<"disp1"<<end1; } void disp() const { cout<<"disp2"<<end1; };int main () { const sample a(1,2); a.disp(); return 0; } 该程序运行后的输出结果是
A.disp1
B.disp2
C.disp1 disp2
D.程序编译时出错
有下列程序段: struct St {int x;int *y;)*pt; int a[]={1,2),b[]={3,4); struct st c[2]={10,a,20,b); pt=c; 下列选项中表达式的值为11的是()。
A.*pt- >y
B.pt- >x
C.+ +pt- >x
D.(pt+ +)->x
有以下程序段: struct st { int x; int * y; } * pt; int a[] = {1,2} ,b[] = {3,4}; struct st c[2] = {10,a,20,b}; pt=c; 以下选项中表达式的值为11的是()。
A.*pt->y
B.pt->x
C.++pt->x
D.(pt++)->x
A.*pt->y
B.pt->x
C.++pt->x
D.(pt++)->X
A.*pt->y
B.pt->x
C.++pt->x
D.(pt++)->x
A.(1,-2)
B.(2,3)
C.(3,5)
D.(3,1)
有如下程序段: int a[10]={1,2,3,4,5,6,7,8,9,10}; int *p=&a[3],b;b=P[5];则b的值是()。
A.5
B.6
C.9
D.8