执行以下程序,输出结果的最后一行语句是______。
include <iostream.h>
class Sample
{
int x,y;
public:
Sample(){x=y=0;}
Sample(int a,int b){x=a;y=b;}
~Sample()
{
if(x==y)
cout<<"x!=y"<<end1;
else
cout<<"x!=y"<<end1;
}
void disp()
{
cout<<"x="<<x<<",y="<<y<<end1;
}
};
void main()
{
Sample s1(2,3);
s1.disp();
}
第1题:
下列程序段的输出结果是 #include<iostream.h> void fun(int * x,int * y) { cout << * X << * y; *X=3; *y=4; } void main() { int x=1,y=2; fun(&y,&x); cout << X << y<<endl; {
A.2143
B.1212
C.1234
D.2112
第2题:
执行以下程序后的输出结果为( )。#include<iostream. b>class Sample{ int x, y; public: Sample() { x=y=0;} Sample(int a, int b) {x=a; y=b; } void disp () { cout<<"x="<<x<<"y="<<y<<end1; }};void main(){ Sample s(2,3), *p=&s; p->disp();}
A.x=1, y=3
B.x=2, y=4
C.x=3, y=2
D.x=2, y=3
第3题:
以下程序执行后的输出结果是 #include<iostream>. using namespace std; void try(int,int,int,int); int main() { int x,y,z,r; x=1; y=2; try(x,y,z,r); cout<<r<<end1; return 0; } void try(int x,int y, int z,int r) { z = x+y; x = x*x; y = y*y; r = z+x+y; }
A.18
B.9
C.10
D.不确定
第4题:
下列程序段的输出结果是 #include<iostream.h> void fun(int*x,int*y) {cout<<*x<<*y; *X=3; *y=4; } void main() {int x=1,y=2; fun(&y,&x); cout<<X<<y<<endl; }
A.2143
B.1212
C.1234
D.2112
第5题:
下列程序段的输出结果是 #include<iostream.h> void fun(int * X,int * y) { cout < < * X < < * y; * X=3; * y=4; } void main( ) { int x=1,y=2; fun(&y,&x); cout < < X < < y < < end1; }
A.2143
B.1212
C.1234
D.2112