填空题下面程序的输出结果为{{U}} 【8】 {{/U}}。
#include<iostream.h>
void main( )
{
int num=0,i=8;
do{
i--;
num ++;
}while(--i);
cout<<num<<end1;
}
填空题数据流图中父图和子图的平衡是指 【2】 。
填空题若执行下面程序段后的输出为:345,请填空。
int a,b=3,c=5;
a=b<c? {{U}} 【7】 {{/U}}:c++;
cout<<a<<b<<c;
填空题在深度为5的完全二叉树中,叶子结点的个数最多为
________
。
填空题若有:
int i=1000;
int * ip=&i;
void * VP;
vp=ip;
其中,vp=ip的含义是 ______。
填空题有以下程序:
#include <iostream>
#include <string>
using nameSpace std;
class person
{
int age;
Char * name;
public:
person ( int i, Char * str )
{
int j;
j = strlen( str ) + 1;
name = new char[ j ];
strcpy( name, str );
age = i;
}
~person()
{
delete name;
cout<<"D";
}
void display()
{
cout<<name<<":"<<age;
}
};
int main()
{
person demo( 30,"Smith" );
demo.display();
return 0;
}
则该程序的输出结果为:{{U}} 【13】 {{/U}}。
填空题多态性分为两类:编译时的多态性和______。
填空题若从键盘输入70,则以下程序输出的结果是【 】。
#include<iostream.h>
void main( )
{ int a;cin>>a;
if(a>50) cout<<a;
if(a>40)cout<<a;
if(a>30)cout<<a}
填空题下面程序的结果为 【7】 。 #include<iostream.h> voidmain() int a=1,b=2; bool c=1; if((a>b)||(c)cout <<"ture" <<end1; else cout <<"false" <<end1;
填空题下面是用来计算n的阶乘的递归函数,请将该函数的定义补充完整。(注:阶乘的定义是) n!=n*(n-1)*...*2*1)
unsigned fact(unsigned n)
{
if (n <=1)
return 1;
return______;
}
填空题如下程序声明了一个电话号码类PhoneNumber,重载了流插入运算符<<,以便于电话号码的输出。请将程序补充完整。
#include<iostream>
#include<iomanip>
#include<string>
using namespace std;
class PhoneMunber{
public:
void setNumber(string number){this->number=number;}
//重载流插入操作符
friend______(ostream &output,const PhoneNumber &num)
{output<<num.number;returnoutput;}
private:
string number;
);
int main(){
PhoneNumber phone;
phone.setNumber(“8008100598”);
cout<<“The phone number is:”<<phone<<endl;
return 0;
)
填空题程序的测试方法分为静态分析和动态分析。使用测试用例在计算机上运行程序,使程序在运行过程中暴露错误,这种方法称为 【4】 。
填空题在深度为5的完全二叉树中,叶子结点的个数最多为______。
填空题下面是复数类complex的定义,其中作为友元函数重载的运算符“--”的功能是将参数对象的实部减1,然后返回对该对象的引用;请补充完整。 class complex private: int real; int imag; public: complex(int r=0,int i=0):real(r),imag(i) void show() cout((real<<(imag<0?”-”:”+”)<(imag<<‘i’; ______; ; complex& operator--(complex &c) c.real--; return C;
填空题语句cout<<setiosflagags(ios::showpos)<<125<<"/t"<<-125<<endl;的输出结果为 【14】 。
填空题下列程序的输出结果为______。 #include<iostream.h> int) void main( ) int n=3,m=12; max(m,n)++; cout<<"m="<<m<<",n=<<n<<endl;
填空题实体联系模型是一种常用的高级{{U}} 【4】 {{/U}}模型,而{{U}} 【5】 {{/U}}是实体联系模型中的核心。
填空题下列程序中声明了两个类AA和BB,其中函数“print”是类AA的成员函数,但是类BB的友元函数。
请在①、②和⑧处各填入正确的内容,使程序能正常运行。
#include<iostream.h>
{{U}} [12] {{/U}};
class AA{
int t;
public:
AA(int x){t=x;}
void print(BB
};
class BB{
int s;
public:
BB(int y){s=y;}
friend void{{U}} [13] {{/U}}print(BB
BB n(8);
m.print(n);
}
输出结果为:AA:6;BB:8
填空题下面程序的输出结果是______。 #define MIN(a,b)(((a)<(b))?a:b) #include <iostream.h> void main() int x=3,y=5; cout<<MIN(x,y)<<endl;
填空题在结构化分析中,用于描述加工逻辑的主要工具有三种,即:结构化语言、判定表、 [4] 。
