求1~100的和,可写成for(s=0,i=1; 【6】 ;i++)s+=i;的形式。

i<=100或i<101

表达式x.operator+(y.operator++(0))还可以写成 【7】

x+y++或x+(y++)

耦合和内聚是评价模块独立性的两个主要标准,其中 【8】 反映了模块内各成分之间的联系。

类中数据成员和成员函数的默认访问级别为 【9】

已知:double A(double A)return++a;和int A(int a)return ++a;)是一个函数模板的两个实例,则该函数模板定义为 【10】

template<typename T>
TA(T a){retum a++;)

下列程序的输出结果是 【11】
#include<iostream>
using namespace std;
class Test
public:
Test( )cnt++;)
~Test( )cnt--;)
static int Count( )retum cnt;
private:
static int cnt;

int Test::cnt=0;
int main( )

cout<<Test::Count( )<<’’;
Test t1,t2;
Test*pT3=new Test;
Test*p T4=new Test;
cout<<Test::Count( )<<’’;
delete pT4;
delete pT3;
cout<<Test::Count( )<<endl;
return0;

创建对象数组时,对数组的每一个元素都将调用一次构造函数,如果没有显式给出数组元素的初值,则调用缺省构造函数。下列程序涉及对象数组的创建和单个对象的创建,其输出结果是 【12】
#include<iostream>
using namespace std;
class Foo
public:
Foo(int x)cout<<’A’;)
Foo( )

int main( )

Foo f[3],g(3);
return0;

下列程序的输出结果是 【13】
#include<iostream.h>
void main( )

int i(1),j(2),k(3),a(10);
if(!i)
a--;
else if(j)
if(k)a=5;
else
a=6;
a++;
cout<<a<<endl;
if(i<j)
if(i!=3)
if(!k)
a=1;
else if(k)
a=5;
6+=2;
cout<<a<<endl;

下列程序的输出结果是 【14】
#include<iostream.h>
void main( )

inta(5),b(6),i(0)1j(0);
switch(a)

case 5:switch(b)

case 5:i++;break;
case 6:j++;break;
defaun:i++;j++;

case 6:i++;
j++;
break;
default:i++;j++;

cout<<i<<","<<j<<endl;
)

以下程序的执行结果是 【15】
#include<iostream>
#define PI____3.14159
const int R=10;
void main( )

double a,b;
ac2*R*PI;
b=R*R*PI;
cout<<"a="<<a<<","<<"b="<<b<<endl;"

a=FB.HCAH,b=CAD.AEI

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