在C++的面向对象程序设计框架中, 【6】 是程序的基本组成单元。

在C++语言中,唯一的一个三目运算符是 【7】

有一种只在循环语句或switch语句中使用的流程控制语句,表示该语句的关键字是 【8】

下列程序的输出结果是 【9】
#include<iostream>
using namespace std;
int main( )
int i=3;
int &r=i; r=5;
cout<<i<<endl;
return 0;

函数f( )的功能是将形参x的值转换为二进制数,所得二进制数的每一位数放在一维数组y中返回。二进制的最低位放在下标为0的元素中,请将程序补充完整。
void f(int x,int y[])
int m=0,n;
do
n=x% 【10】
y[m++] =n;
x/=2;
while(x);

在C++中,类的成员有3种访问权限,它们分别是公有、 【11】 和私有。

下列程序在构造函数和析构函数中申请和释放类的私有成员,请完成该程序。
class Myclas
int *x;
public:
MyClas(int n);
~MyClas( );

MyClas::MyClas(intn)
【12】

MyClas::~MyClas( )
【13】

x=new int(n),delete x

在C++中,设置虚基类的目的是 【14】

以下程序执行后输出的结果是 【15】
#include<iostream>
#include<fstream>
using namespace std;
int main( )
ofstream ofile("D://temp.txt");
if(!ofile)
cout<<"temp.txt cannot open"<<endl;
return 0;

ofile<<"This is a book" <<" " <<54321<<endl;
ofile.close( );
ifstream ifile("D://temp.txt");
if(!ifile)
cout<<"temp.txt cannot open" <<endl;
return 0;

charstr[40];
ifile >> str;
ifile.close( );
cout<<Str<<endl;
return 1;

要定义数组a,使得其中每个元素的数据依次为3,9,4,8,0,0,0,错误的定义语句是 ( )。

A:int a[]=3,9,4,8,0,0,0; B:int a[9]=3,9,4,8,0,0,0; C:int a[]=3,9,4,8; D:int a[7]=3,9,4,8,0,0,0;

微信扫码获取答案解析
下载APP查看答案解析