有如下程序: #include<iostream> using namespace std; class Part{ public: Part(int x=0):val(x){cout< ~Part( ){cout<<val;} pritave: int val; }; class Whole{ public: Whole(int x,int Y,int z=0):p2(x),p1(Y),val(z){cout<<val;} ~Whole( ){cout<<val;} pritave: Part p1,p2; int val; f; int main( ){ Whole obj(1,2,3); return 0; } 程序的输出结果是
A.123321
B.213312
C.213
D.123123
第1题:
有如下程序: #include<iostream> using namespace std; class Part{ public: Part(int x=0):val(x) {cout<<val;} ~Part(){cout<<val;} private: int val; }; class Whole{ public: Whole(int x ,int y, int z=0):p2(x),p1(y),val(z){cout<<val;} ~Whole(){cout<<val;} private: Part p1,p2; int val; }; int main() Whole obj(1,2,3); return 0; } 程序的输出结果是( )。
A.123321
B.213312
C.213
D.123123
第2题:
写出下列程序的运行结果【 】。
include<iostream. h>
void func(double x, int &part1, double &part2){
part1=int(x)+500:
part2=(x+500-part1)*100;
}
void main( ){
int n;
double x, f;
x=1001. 0103;
func (x, n, f):
cout<<"Part 1="<<n<<" , part2="<<f<<end1
}
第3题:
第4题:
如下程序的输出结果是 #include<iostream> void fun(int & X,inty){intt=x;x=y;y=t;} int main( ){ int a[2]={23,42}; fun(a[1],a[0]); std::cout<<a[0]<<","<<a[1]<<std::endl; return 0; }
A.42,42
B.23,23
C.23,42
D.42,23
第5题:
有如下程序: #jnClude<iostream> using namespaCe std; Class Part{ publiC: Part(int x=0):val(X){Cout<<val;} ~Part{Cout<<val;} private: int val; t }; Class Whole{ publiC: Whole(int x,int Y,int z=0):p2(x),pl(y),val(z){Cout<<val;} ~Whole{eout<<val;} private: Part pl,p2; int val; }; int main { Whole obj(1,2,3); return 0; } 执行这个程序的输出结果是( )。
A.123321
B.213312
C.213
D.123123