若将子过程SUB中的PRIVATE X改为PRIVATE Y,则X的输出结果为 ______。
A.5
B.11
C.8
D.3
第1题:
有以下程序: #include <iostream> #include <string> using namespace std; class Y; class X { private: int x; char *strx; public: X(int a, char *str) { x=a; strx=new char[strlen(str)+1]; strcpy(strx,str); } void show(Y &ob) ; }; class Y { private: int y; char *stry; public: Y(int b,char *str) { y=b; stry=new char[strlen(str)+1]; strcpy(stry, str); } friend void X: :show(Y &ob) ; }; void X: :show(Y &ob) { cout<<strx<<", "; cout<<ob, stry<<end1; } int main ( ) { X a(10,"X"); Y b (20, "Y"); a. show(B) ; return 0; } 执行后的输出结果是( )。
A.X,Y
B.a,b
C.X,X
D.Y,Y
第2题:
若将输出语句? X1+X2+X3改为?X1,X2,X3,且将子程序最后一行的TO MASTER 删除,则X1的输出结果为 ______。
A.10
B.11
C.12
D.13
第3题:
若将输出语句?X1+X2+X3改为? X1,X2,X3,且将子程序最后一行的TO MASTER 删除,则X3的输出结果为 ______。
A.10
B.11
C.12
D.13
第4题:
若将程序中的&& 删除,则X,Y的输出结果为 ______。
A.0 2
B.2 4
C.6 6
D.1 3
第5题:
若将输出语句? X1+X2+X3改为?X1,X2,X3,且将子程序最后一行的TO MASTER 删除,则X2的输出结果为 ______。
A.10
B.11
C.12
D.13