填空题以下程序的输出结果是{{U}} 【8】 {{/U}}。
#include<iostream>
using namespace std;
int main(){
int sum,i;
for(sum=0,i=1;i<5;i++)sum+=i;
cout<<sum<<endl;
return 0;
}
填空题下列程序的输出结果为012,请根据注释将横线处的缺失部分补充完整。
#include<iostream>
using namespace std;
class Test{
public:
Test(int a){data=a;}
~Test(){}
void print(){cout<<data;}
private:
int data;
};
int main(){
Test t[3]={______};//对有3个元素的Test类对象数组t初始化
for(int i=0;i<3;i++)t[i].print();
return 0;
}
填空题下面程序的执行结果是______。
#include<iostream>
using namespace std;
int main(){
int i=0;
char a[]="asd",b[]="aqzx",c[10];
while(a[i]!="/0"
else c[i]=b[i++]-32;
c[i]="/0";
cout<<c<<endl;
return 0;
}
填空题浮点数的默认精度值是{{U}} 【3】 {{/U}}。
填空题下面程序的输出结果为{{U}} 【15】 {{/U}}。
#include<iostream.h>
main()
{
char a[]="morning",t;
int i,j=0;
for(i=1;i<7;i++)
if(a[j]<a[i])
j=i;
t=a[j];
a[j]=a[7];
a[7]=a[j];
cout<<a;
}
填空题指针变量所保存的不是一般的数据值,而是程序中另一个对象的 ______。
填空题有以下程序:
#include <iostream>
using namespace std;
class MyClass
{
public:
MyClass();
~MyClass();
static int s;
void SetValue(int val);
};
int MyClass::s=0;
MyClass::MyClass()
{
s++;
}
void MyClass::SetValue(int val)
{
s=val;
}
int main()
{
MyClass my[3],*p;
p=my;
for(int k=0;k<3;k++)
{
p->SetValue(k+1);
p++;
}
cout<<MyClass::s<<end1;
return 0;
运行后的输出结果是{{U}} 【13】 {{/U}}。
填空题有如下程序:
#include<iostream>
using namespace std;
class Monitor{
public:
Monitor(char t):type(t){ }
void Print( )const
{ cout<<"The type of monitor is"<<type<<endl;)
private:
char type:
};
class Computer{
public:
Coinputer(int i,char c):______{ }
void Print( )const
{ cout<<"The computer is"<<id<<endl;mon.Print( );}
private:
int id;
Monitor mon;
};
int main( ){
const Computer myComputer(101,'B');
myComputer.Print( );
return 0;
}
请将程序补充完整,使程序在运行时输出:
The computer is 101
The type of monitor is B
填空题阅读下面的程序: #include <iomanip.h> void main() cout.fill('!'); cout<<setiosflags( ios:: left)<<hex; cout<<setw(6)<<1024<<endl; 写出该程序的输出结果:______。
填空题关系数据库的关系演算语言是以
________
为基础的DML语言。
填空题int(*p)[6];,当有定义int a[4][6],并让p指向它的语句是 【10】 。
填空题耦合和内聚是评价模块独立性的两个主要标准,其中 【8】 反映了模块内各成分之间的联系。
填空题下面程序的输出结果是
________
。
#include <iostream>
using namespace std;
int x;
void funA(int
void funB(int,int
int main ( )
{
int first;
int second=5;
x=6;
funA(first,second) ;
funB(first,second) ;
cout<<first<<" "<<second<<" "<<x<<end1;
return 0;
}
void funA(int
first=a+b;
a=2*b;
b=first+4;
}
void funB(int u, int
second=x;
v=second+4;
x=u+v;
}
填空题当线性表采用顺序存储结构实现存储时,其主要特点是【 】。
填空题开发一个C++语言程序的步骤通常包括编辑、{{U}} 【6】 {{/U}}、链接、运行和调试。
填空题有以下程序:
#include <iostream>
using namespace std;
int f(int);
int main()
{
int i;
for(i=0;i<5;i++)
cout<<f(i)<<" ";
return 0;
}
int f(int i)
{
static int k=1;
for(;i>0;i--)
k+=i;
return k;
}
运行后的打印结果是{{U}} {{U}} {{/U}} {{/U}}。
填空题指针变量所保存的不是一般的数据值,而是程序中另一个对象的______。
填空题完成下列类的构造函数,初始化语句为{{U}} 【13】 {{/U}}。
#include <iostream. h>
class Test
{
private:
int x, y;
public,
void Test(int initx, int inity){
______
}
void printx() {cout<<x<<"—"<<y<<"="<<x-y;}
};
void main()
{
Test x(300, 200);
x. printx(); }
填空题下面程序的输出为______。#include <iostream.h>void main()int a[10],i, k=0;for(i=0,i<10;i++)a[i]=i;for(i=1;i<4;i++)k+=a[i]+i;cout<<k<<end1;
填空题若有定义语句“int x=10;”,则表达式“x<=10?20:30”的值为【6】。