单选题有以下程序:
#include<iostream>
using namespace std;
class sample
{
private:
int n;
public:
sample(){}
sample(int m)
{
n-m;
}
sample add(sample s1,sample s2)
{
this->n=s1.n+s2.n;
return(*this):
}
void disp()
{
cout<<"n="<<n<<endl;
}
};
int main()
{
sample s1(10),s2(5),s3;
s3.add(s1,s2);
s3.disp();
return 0;
}
程序运行后,输出的结果是______。
单选题有如下程序
#include<iostream.h>
void main()
{char ch[2][5]=={"6937","8254"},*p[2];
int i,j,s=0;
for(i=0;i(2;i++)p[i]=ch[i];
for(i=0;i(2;i++)
for(j=0;p[i][j]>"/0,j+=2)
s=10*s+p[i][j]-"0";
cout<<s;}
该程序的输出结果是
____
。
单选题下列各循环语句中,不是死循环的是( )。
单选题若要对Date类中重载的加法运算符成员函数进行声明,下列选项中正确的是( )。
单选题下列虚基类的声明中正确的是______。
单选题下列代码段声明了3个类
class Person{};
class Student:public Person{};
class Undergraduate:Student{};
下列关于这些类之间关系的描述中,错误的是______。
单选题已知类Base和类Derived的定义如下:
class Base{
int n;
public;
Base(int d); n(d){}
};
class Derived: public Base{
public:
______
};
其中横线处应为类Derived的构造函数的定义。
在下列构造函数的定义中.正确的是______。
单选题以下程序的输出结果是 #include<iostream.h> long fun(int n) {long s; if(n=1||n=2) s=2; else s=n-fun(n-1): return s; } void main() {cout<<fun(3);=
单选题已知一个类A,类A有三个公有成员:void f1(int),void f2(int)和int a;定义指向类A成员函数的指针是( )。
单选题计算数列第 n 项的函数定义如下: int a(int n){ if (n == 0) return 0; else if (n == 1) return 1; else if (n == 2) return 2; else return a(n-1)+a(n-3); }若执行函数调用表达式 a(4),函数 a 被调用的次数是
单选题下面程序输出的结果为( )。
#include" iostream.h"
class A
{
public:
A( ) { cout < < "CLASS A" < < end1;}
~ A( ) { }
};
class B:public A
{
public:
B( ){ cout < < "CLASS B" < < end1;}
~ B( ) { }
};
void main( )
{
A * p;
p=new B;
B * q;
q=new B;
}
单选题软件生命周期中的活动不包括( )。
单选题有如下数组声明:int value [30];,下标值引用错误的是
____
。
单选题模块独立性是软件模块化所提出的要求,衡量模块独立性的度量标准则是模块的
____
。
单选题下列关于构造函数的描述中,错误的是______。
单选题下列关于模板的叙述中,错误的是______。
单选题下列运算符不能重载为友元函数的是( )。
单选题下列函数中,( )是对文件进行写操作的。
单选题对定义重载函数的下列要求中,( )是错误的。 A.要求参数的个数不同 B.要求参数中至少有一个类型不同 C.要求参数个数相同时,参数类型不同 D.要求函数的返回值不同
单选题有关系R和S,关系代数运算R∩s等价于 ______。