单选题有如下程序:#include <iostream>using namespace
std:class Test{public: Test()
{n+=2; ~Test() {n-=3; ; static int
getNum() {return n;}privaue: static int n:};int
Test::n=1;int main(){ Test* p=new Test;
delete p; cout<<"n="<<Test::getNum()<<end1; return
0;}执行后的输出结果是
A. n=0
B. n=1
C. n=2
D. n=3
单选题派生类的对象对它的基类成员中( )是可以访问的。 A) 公有继承的公有成员 B) 公有继承的私有成员 C) 公有继承的保护成员 D) 私有继承的公有成员
单选题重载输入流运算符>>必须使用的原型为______。
单选题下面程序的输出结果为( )。 #inelude<iostream.h> void main() int x; int //变量引用 y=99; cout<<"x="<<x<<end1;
单选题下面程序的功能是( )。 #include <iostream> #include <string> using namespace std; int main () { int i=1, n=0; char s[80],*p; p=s; strcpy(p,"It is a book.."); for (; *p !=' /0' ;p++) { if(*p=='') i=0; else if (i==0) { n++; i=1; } } cout<<"n=" <<n<<end1; return 0; }
单选题已知类Time的定义如下:
class Time{//时间类
private:
int hour, minute, second; //时、分、秒
public:
Time(int h, int m, int s): hour(h), minute(m), second(s){}
______{
switch(index){
case 0:
return hour;
case 1:
return minute;
default:
return second;
}
}
};
其中横线处应为下标访问运算符[]的重载函数的函数头,横线处应填入的代码是______。
单选题以下程序的执行结果是 ______。 #include<iostream.h> class Sample { int x; public: Sample(){}; Sample(int a){x=a;} Sample(Sample } void disp(){cout<<"x="<<x<<end1;} } void main() { Sample s1(2),s2(s1); s2.disp(); }
单选题执行下列语句段后,输出字符''*"的个数是( )。 for(int i=50;i>1:--i)cout<<'*';
单选题为使下列程序的正确输出结果为: Now is 2004-7-6 12:12:12 那么应该在程序划线处填入的语句是( )。 #include <iostream> using namespace std; class TIME; class DATE public: DATE(int y=2004,int m=1,int d=1) year=y; month=m; day=d; void DateTime(TIME private: int year,month, day; ; class TIME public: TIME(int h=0,int m=0,int s=0) hour=h; minute=m; second=s; ______________; //将类 DATE 中成员函数 DateTime 声明为类 TIME 的友元函数 private: int hour,minute, second; ; void DATE: :DateTime(TIME int main ( ) DATE d(2004,7,6); TIME t (12, 12, 12); d. DateTime (t); return 0;
单选题友元运算符obj1>obj2被C++编译器解释为
____
。
单选题下列C++语言符号中表示行注释开始的是 ______。
单选题Windows环境下,由C++源程序文件编译而成的目标文件的扩展名是( )。
单选题对长度为n的线性表排序,在最坏情况下,比较次数不是n(n-1)/2的排序方法是( )。
单选题以下程序的输出是
____
。
struct st
{
int x;int *y;
}
*p;
int dt[4]={10,20,30,40};
struct st aa[4]={50,&dt[0],60,&dt[0],60,&dt[0],60,&dt[0],};
main()
{
p=aa;
cout<+<+(p->x);
}
单选题判断char型变量c是否为小写字母的正确表达式是
单选题下列程序的输出结果是
____
。
#include<iostream.h>
main()
{
int m=5;
if(m++>5)
cout<<m;
else cout<<m--;
}
单选题下列选项中,不属于数据管理员(DBA)职责的是( )。
