选择题 对软件的特点,下面描述正确的是______。
选择题 若已经声明了函数原型“bool fun(bool a,int b=0);”,则下列重载函数声明中正确的是______。
选择题 ______给出了数据库物理存储结构与物理存取方法
选择题 在定义一个类模板时,模板形参表是用一对括号括起来的,所采用的括号是______。
选择题 对于下面定义的类MyClass,在函数f()中将对象成员n的值修改为50的语句应该是______
class MyClass
{
public:
MyClass(int x) {n=x;}
void SetNum(int nl) {n=nl;}
private:
int n;
}
int f()
{
MyClass *ptr=new MyClass(45);
______
}
选择题 有以下类定义
class MyClass
{
private:
int id;
char gender,
char*phone;
public:
MyClass():id(0),gender('#'),phone(NULL){}
MyClass(int no,char ge='#',char*ph=NUl1.)
{id=no;gende=ge;phone=ph;}
};
下列类对象定义语句中错误的是______。
选择题 有以下程序
#include <iostream>
using namespace std;
static int days[]= { 31,28,31,30,31,30,31,31,30,31,30,31 };
class date
{
private:
int month, day, year;
public:
date( int m, int d, int y )
{
month = m;
day = d;
year = y;
}
date()
{}
void disp()
{
cout<<year<<'-'<<month<<'-'<<day<<end1;
}
date operator+( int day )
{
date dt = *this;
day+= dt.day;
while ( day > days[dt.month - 1 ] )
{
day -= days[ dt.month - 1 ];
if ( ++dt.month == 13 )
{
dt.month = 1;
dt.year++;
}
}
dt.day = day;
return dt;
};
int main()
{
date d1( 6, 20, 2004 ), d2;
d2: d1 + 20;
d2.disp();
return 0;
}
执行后的输出结果是
选择题 有以下程序:
void fun(int a*a,int i,int i)
{int t;
if(i<j);
{t=a[i];a[i]=a[j];a[j]=t;
fun(a,++i,--j);
}
}
main()
{inta[]={1,2,3,4,5,6},i;
fun(a,0,5);
for(i=0;i(6;i++)
cout<(a[i];
}
执行后输出结果是 。
选择题 有如下程序:
#include<lostream>
using namespace std;
class MyClass{
public:
MyClass() { cout<< '*'; }
MyClass(MyClass a) { cout<< '#'; }
~MyClass() { cout<< '@'; }
};
int main();
MyClass a;
Myclass b(a);
return 0;
}
运行时的输出结果是______。
选择题 下列关于成员函数特征的描述中,错误的是 。
选择题 以下程序的输出结果是______。
#inclucle<iostrcam.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);}
选择题 下列有关继承和派生的叙述中,正确的是______。
选择题 有如下4个语句:
①cout<<'A'<<setfill('*')<<left<<setw(7)<<'B'<<endl;
②cout<<setfill('*')<<left<<setw(7)<<'A'<<'B'<<endl;
③cout<<'A'<<serfill('*')<<right<<setw(7)<<'B'<<endl;
④cout<<setfill('*')<<right<<setw(7)<<'A'<<'B'<<endl;
其中能显示A******B的是______。
选择题 关于虚函数,下列表述中正确的是______。
选择题 下面程序的运行结果为______。
#include<iostream. h>
class A
{
public:
A() {cout<<'1';}
~A() {cout<<'2';}
};
class B: public A
{
public:
B() {cout<<'3';}
~B() {cout<<'4';}
};
void main()
{
B b;
}
选择题 数据结构中,与所使用的计算机无关的是数据的______
选择题 若要重载+、=、<<、=和[]运算符,则必须作为类成员重载的运算符是
选择题 下列关于文件流的描述中,正确的是______。
选择题 有如下程序:
#include<iostream>
using namespace std;
class MyClass{
public:
MyClass(){cout<<'A';}
MyClass(char c){cout<<c;}
~MyClass(){cout<<'B';}
};
int main(){
MyClass p1.*p2;
p2=new MyClass('X');
delete p2;
return 0;
}
执行这个程序的输出结果是______。
选择题 下列语句都是程序运行时的第1条输出语句,其中一条语句的输出效果与其他三条语句不同,该语句是______。