单项选择题

下列程序的执行结果是( )。
#include<iostream.h>
#include<stdlib.h>
class TestClass

public:
intx,y;
TestClass()x=y=0;
TestClass(int a,int b)x=a;y=b;
void disp()

cout<<"X"="<<X<<",y="<<y<<endl;

;
void main()

TestClass sl(2,3);
s1.disp();

A.x=2,y=2
B.x=3,y=3
C.x=2,y=3
D.x=3,y=2
<上一题 目录 下一题>
热门 试题

单项选择题
有下列的程序: #include<cstring.h> #include<iostream.h> using namespace std; class MyString public: MyString(const char*s); ~MyString()<delete[]data; protected: unsigned len; char*data; ; MyString∷MyString(const char*s) len=strlen(S); data=new char[1en+1); strcpy(data,s); int main() MyString a( C++Programing ); MyString b(
A.;
return 0;

在运行上面的程序时出错,出错的原因是( )。A) 构造函数的实参不允许是本类的对象
B.没有定义实现深层复制(深拷贝)的复制构造函数
C.构造对象a时实参与形参类型不符
D.系统不能生成默认的复制构造函数
单项选择题
下列程序的输出结果是( )。 #include<iostream> using namespace std; int main() char a[]= Hello,Test ; char*p=a; while(*p) if(*p>=’a’&&*p<=’z’) cout<<char(*p+’A’-’a’); else cout<<*p; p++; retum 0;
A.hllo,test
B.Hello,Test
C.HELLO,TEST
D.hELLO,tEST
相关试题
  • 有下列程序: #include<iostream> usi...
  • 如果表达式x=y*z中的“*”是作为成员函...
  • 重新定义标识符的作用域规定是外层变量被隐...
  • 以下函数模板max()的功能是返回数组a中最...
  • 重载的关系运算符和逻辑运算符的返回类型应...