单选题概念模型是 ______。
单选题有如下类定义: class TV public: TV(int s=41,string br="TCL"):size(s),brand(br) ~TV() private: int size; string brand; ; 若执行语句 TV li,*net[2],company[3]; 则TV类的构造函数被调用的次数是______。 A.6次 B.4次 C.3次 D.2次
单选题下面程序的输出结果是( )。 #include<iostream> #include<math.h> using namespace std; class point private: double x; double y; public: point(double a,double b) x=a; y=b; friend double distances(point a,point b); ; double distances(point a,point b) return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y)); int main() point p1(1,2); point p2(5,2); cout<<distances(p1,p2)<<end1; return 0;
单选题若有以下程序:# include <iostream>using namespace std;void sub(int x, int y, int *z){ *z = y+x;}int main (){ int a,b, c; sub[8,4. sub (6, a, sub (a.b, cout<<a<<" , "<<b<<", "<<c<<end1; return 0;} 程序运行后的输出结果是
单选题为了避免嵌套的if...else语句的二义性,C++规定与else配对的是
单选题某二叉树有5个度为2的结点,则该二叉树中的叶子结点数是______。
单选题有如下程序:
#inchde
using namespace std;
int i=1:
class Fun
{
public:
static int i:
int value(){return i-1;)
int valueoconst{return i+1;}
};
int Fun::i=2:
int main()
{
int i=3:
Fun fun1;
const Fun fun2;
return 0:
}
若程序的输出结果是:123
则程序中横线处的语句是( )。
单选题定义如下枚举类型enumMonday,Tuesday,Wednesday,Thrusday,Friday=2);则下列选项正确的是( )。
单选题若要把函数void f()定义为aClass的友元函数,则应该在类aClass的定义中加入的语句是( )。 A.void f(); B.static voidf(); C.friend f(); D.friend void f();
单选题函数fun的返回值是 fun(char * a, char * b) int num=0,n=0; while( * (a+num) !='/0') num++; while(b[n] ) * (a+num) =b[n] ;num++;n++; return num; A) 字符串a的长度 B) 字符串b的长度 C) 字符串a和b的长度之差 D) 字符串a和b的长度之和
单选题下列语句中,错误的是( )。
单选题如下程序运行时的输出结果是
#include<iostream>
using namespace std;
class ONE{
int c;
public:
ONE( ):c(0){eout<<1;}
ONE(int n):C(n){cout<<2;}
};
class TW0{
ONE onel;
ONE one2;
public:
TWO(int m):one2(m){eout<<3;}
};
int main( ){
TWO t(4);
return 0;
}
单选题有如下程序:
#include <iostream>
using namespace std;
class Base
{
private:
void fun1( ) const {cout<<"fun1";}
protected:
void fun2( ) const {cout<<"fun2";}
public:
void fun3( ) const {cout<<"fun3";}
};
class Derived: protected Base
{
public:
void fun4( ) const {cout<<"fun4";}
};
int main( )
{
Derived obj;
obj.fun1( ); //④
obj.fun2( ); //②
obj.fun3( ); //③
obj.fun4( ); //④
return 0;
}
其中有语法错误的语句是______ 。
单选题在公有派生情况下,有关派生类对象和基类对象的关系,下列叙述不正确的是 A) 派生类的对象可以赋给基类的对象 B) 派生类的对象可以初始化基类的引用 C) 派生类的对象可以直接访问基类中的成员 D) 派生类的对象的地址可以赋给指向基类的指针
单选题若有如下语句 #include<iostream.h> void main() { int x=3; do{ x=x-2 cout<<x; {while (! (- -x); } 则上面程序段( )
单选题现代微型计算机中所采用的电子器件是( )。
单选题有如下函数定义:void func(int a,int& b){a++;b++;}若执行代码段:int x=0,y=1;func(x,y);则变量x和y的值分别是( )。
单选题下列运算符中,在C++语言中不能重载的是( )。
单选题下列关于模板的叙述中错误的是______。
单选题下列程序的输出结果是 #include<iostream.h> int b=2; int func(int *