有如下模板声明: templateclassA; 下列声明中,与上述声明不等价的是()。A.templateclassA;B.t
有如下模板声明: templateclassA; 下列声明中,与上述声明不等价的是()。
A.templateclassA;
B.templateclassAt
C.templateclassA;
D.templateclassA;
有如下模板声明: templateclassA; 下列声明中,与上述声明不等价的是()。
A.templateclassA;
B.templateclassAt
C.templateclassA;
D.templateclassA;
第1题
设有定义charstr[80];以下不能将输入数据first\nsecond\n读取到数组str中的语句是( )。
A.cin.get(str,strlen(str));
B.cin.getline(str,strlen(str));
C.cin>>str;
D.cin.read(str,strlen(str));
第2题
执行下列程序后,w的值为( )。 intw=A,x=14,y=15; w=((x‖y)&&(w<a));
A.-1
B.NULL
C.1
D.0
第3题
下列语句中,与语句“n=(a>b?(b>c?1:0):0);”的功能等价的是( )。
A.if(ab)‖(b>c))n=1;elsen=0;
C.if(a>b)if(b>c)n=1;elsen=;elsen=0;
D.if(a>b)n=1;elseif(bc)n=1;elsen=0;
第4题
下列程序的执行结果为( )。
include<iostream.h>
void main
{
int a=3,b=0;
int*P =&a;
b=+a++;
cout<<*P<<”,”<<b<<endl;
}
A.3,4
B.4,3
C.3,4
D.4,4
第5题
有如下程序:
int x=3:
do{
x-=2;
COU[<<X:
}while(!(--X));
A.1
B.3 0
C.1—2
D.死循环
第6题
与语句cout<<endl;不等价的是( )。
A.cout <<’\n’;
B.cout<<‘\l2’:
C.cout <<’\xA’;
D.cout<<‘\0’:
第7题
下面程序的运行结果为( )。 include
class A { int hum; public: A(int i){nuln=i;} A(A&A.{num=a.num十+;} void print{eout(<hum;} }; void main A a(1),b(A.; a.print; A print;
A.11
B.12
C.21
D.22
第8题
下面程序的运行结果为( )。
include<iostream.h>
voidmain()
{
chara="3":
switch(a)
{
case"3":cout<<"3";
case"2":cout<<"2";break;
default:cout<<"1";
}
}
A.3
B.321
C.31
D.32
第9题
下面程序的运行结果为( )。
include<iostream.h>
ClassA
{
public:A( ){cout<<"1";}
~A( ){cout<<"2";}
};
ClassB:public:A
{
public:
B( ){cout<<"3";}
~B( ){cout<<"4";}
};
Voidmain( )
{
Bb;
}
A.1234
B.1324
C.1342
D.3142
第10题
有如下程序:
include<iostream>
usingnamespacestd;
classXA{
inta;
public:
staticintb;
XA(intaa):a(aa){b++;}
~XA( ){}
intget( ){returna;}
};
intXA::b=0
intmain( ){
XAd1(1),d2(3);
cout<<d1.get( )+d2.get( )+XA::b<<endl;
return0;
}
运行时的输出结果是( )。
A.5
B.6
C.7
D.8
为了保护您的账号安全,请在“上学吧”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!