单选题有如下程序:
#include<iostream>
using namespace std;
class Base
{
pubfic:
Base(){cout<<"BB";f();}
void f(){cout<<"Bf":}
};
class Derived:public Base
{
public:
Derived(){cout<<"DD";)
voidf(){cout<<"Df":}
};
intmain(){Derived d;retum 0;}
执行上面的程序将输出
单选题有如下程序:
#include<iostream>
using namespace std;
class Bag{
public:
Bag(int p, char s="M"):price(p), size(s) {}
void Show(){cout<<price<<"-"<<size<<""; }
______{cout<<price<<"*"<<size<<"";}
private:
int price;
char size;
};
int main(){
Bag Black(150, "S");
const Bag White(300, "L");
Black.Show();
White.Show();
return 0;
}
若运行时的输出结果为“150-S 300*L”,则划线处缺失的部分是______。
单选题设有以下说明和定义: #include<iostream. h> Void main() typedef union long i; int k[5]; char c; DATE; struct date int cat; DATE cow; double dog; too; DATE max; cout<<(sizeof(struct date)+sizeof(max))<<end1; A) 26 B) 52 C) 18 D) 8
单选题数据字典表达的是 ______。
单选题有如下程序: #include <iostream> using namespace std; int main( ) int*P; *P=9; cout<<"The value at P:"<<*P: return 0; 编译运行程序将出现的情况是
单选题语句cout<<setprecision(2)<<1024.4567;的输出结果为 A) 1024.4567 B) 1024 C) 1024.45 D) le+003
单选题类模板template<class T>class x{…},其中友元函数f对特定类型T(如int),使函数f(x<int>}成为x<int>模板类的友元,则其说明为______。
单选题下列定义语句中,错误的是______。
单选题下列程序中横线处应填入的语句是
____
。
Class Base
{
public:
roid fun(){cout<<“Base of fun”<<endl;)
};
class Derived:public Base
{
void fun()
{
//显示基类的成员函数fun
cout<<“Derived Of fun”<<endl;
}
};
单选题有以下程序 #include <iostream> using namespace std; class sample { private: int x; public: sample(int a) { x=a; } friend double square(sample s); }; double square(sample s) { return s.x*s.x; } int main() { sample s1 (20),s2(30); cout<<square(s2)<<end1; return 0; } 执行结果是
单选题在E—R图中,用来表示实体联系的图形是( )。
单选题若有以下程序: #include <iostream> using namespace std; class data { public: int x; data (int x) { data: :x=x; } }; class A { private: data d1; public: A(int x) : d1 (x) { } void dispa() { cout<<d1, x<<", "; } }; class B: public A { private: data d2; public: B(int x) : A(x-1),d2(x) {} void dispb() { cout<<d2.x<<end1; } }; class C : public B { public: C(int x) : B(x-1){} void disp () { dispa ( ); dispb (); } }; int main ( ) { C obj (5); obj.disp(); return 0; } 程序执行后的输出结果是( )。
单选题下列数据结构中,能够按照“先进后出”原则存取数据的是( )。
单选题下列语句中,错误的是______。
单选题关于this指针的说明不正确的是
单选题下列关于指针运算的描述中,错误的是( )。
单选题已知基类Employees只有一个构造函数,其定义如下:
Employee::Employee(int n):id(n){}
Manager是Employees的派生类,则下列对Manager的构造函数的定义中,正确的是
单选题下列运算符中,不能重载为类的友元函数的运算符是
单选题以下程序的正确运行结果是( )。 #include<iostream.h> hat fun(int); void main() int a=2,i; for(i=0;i<3;i++) cout<<fun(a)<<end1; cout<<end1; int fun(int a) int b=0; static int c=3; b++;c++; return(a+b+c); A) 4, 5, 6 B) 6, 7, 9 C) 7, 8, 9 D) 7, 7, 7
单选题有如下程序:
#include<iostream>
using namespace std;
class Base
{
public:
Base(){cout<<"1";}
~Base(){cout<<"2";}
};
class Derived:public Base
{
public:
Derived(){cout<<"3";}
~Derived(){cout<<"4";}
};
int main()
{
Derived A;
return 0;
}
其运行结果是______。
