单选题公司中有多个部门和多名职员,每个职员只能属于一个部门,一个部门可以有多名职员。则实体部门和职员问的联系是
单选题有如下程序: #include<iostream> using namespace std; class AA{ int k; protected: int n; void setK(int k){this->k=k;} public: void setN(int n){this->n=n;} }; class BB:public AA{/*类体略*/}; int main( ){ BB x; x.n=1: //1 x.setN(2); //2 X.k=3; //3 x.setK(4); //4 return 0; { 在标注号码的4条语句中正确的是
单选题有如下类声明和函数声明 class Base{ int m; public: int n; protected: int p; }; class Derived: protected Base{ public: int k; }; void f(Derived d); 则在函数f中通过d可访问的数据成员的个数是
单选题定义无符号整数类为UInt,下面可以作为类UInt实例化值的是( )。
单选题对于模板定义关键宁class和typename说法不正确的是
____
。
单选题有如下类定义: class MyClass public : ______ private : int data; ;若要为MyClass类重载流输入运算符“>>”,使得程序中可以“cin>>obj;”的形式改变MyClass类的对象obj中数据成员data的值,则横线处的声明语句应为( )。 A) friend istream B) friend istream C) istream D) istream
单选题若调用一个函数,且此函数中没有return语句,则正确的说法是该函数
____
。
单选题下面程序输出的结果为( )。 #inClUde”iostream.h” Class A public: A()cout<<“CLASS A”<<endl; ~A()<); class B:public A public: B()cout<<”CLASSB”<<endl; ~B(); void main() A*p; p=new B; B *q; q=new B;
单选题在语句"cout<<'A';"中,cout 是
单选题设有定义int x; float y;,则10+x+y值的数据类型是______。
单选题有下列程序:
#include <stdio.h>
#define N 4
void fun(int a[][N],int b[])
{ int i;
for(i=0;i<N,i++) b[i]=a[i][i];
}
void main()
{ int x[][N]={{1,2,3},{4},{5,6,7,8},{9.10}},
y[N],i;
fun(x,y);
for(i=0;i<n;i++) printf("%d,",y[i]);
printf("/n");
}
程序的运行结果是______。
单选题软件(程序)调试的任务是( )。
单选题有如下程序:
#include<iostream>
using namespace std;
class Book{
public:
Book(char* t="") {strcpy(title, t); }
______
private:
char title[40];
};
class Novel:public Book{
public:
Novel(char*t=""):Book(t) {}
char* Category() const {return"文学";}
};
int main() {
Book *pb;
pb=new Novel();
cout<<pb->Category();
return 0;
}
程序运行时出现结果是“文学”,则画线处缺失的语句是______。
单选题下列程序的运行结果是
____
。
#include<iostream.h>
void fun(int *a, int *b)
{int *k; k=a; a=b; b=k;}
void main()
{int a=2OO4,b=9,*x=
fun(x, y);
cout<<a<<" "<<b<<end1;}
单选题C++语言中,编译过程后生成的文件类型为{{U}} {{/U}}。
A.*.cpp
B.*.obj
C.*.h
D.*.exe
单选题为了使类中的某个成员不能被类的对象通过成员操作符访问,则不能把该成员的访问权限定义为______。
单选题派生类继承基类的方式有( )。
单选题设数组data[m]作为循环队列SQ的存储空间,front为队头指针,rear为队尾指针,则执行出队操作后其头指针front值为( )。
单选题已知主函数中通过如下语句序列实现对函数模板swap的调用: int a[10],b[10]; swap(a,b,10); 下列对函数模板swap的声明中,会导致上述语句序列发生编译错误的是( )。
单选题有如下程序:
#include<iostream>
using namespace std;
class Complex
{
double re, im;
public:
Complex(double r, double i):re(r), im(i){}
double real()const{return re;}
double image()const{return im;}
Complex
im+=a.im;
return *this;
}
};
ostream
}
int main()
{
Complex x(1, -2), y(2, 3);
cout<<(x+=y)<<endl;
return 0;
}
执行这个程序的输出结果是______。