填空题头文件______中包含了执行内部格式化所需的信息。
填空题假如输入为30和60,下列程序运行的结果是{{U}} [7] {{/U}}。
#include<iostream.h>
void main() {
int a, b;
cin>>a>>b;
if(a<b) {
a=a+b;
b=a-b;
a=a-b;
}
cout<<a<<“,”<<b<<endl
}
填空题建立数据字典的时机是{{U}} [5] {{/U}}。
填空题将x+y中的+运算符用友元函数重载应写为 【11】 。
填空题以下程序的执行结果是 【10】 。#include<iostream.h>class Sampleint n;public:Sample() Sample(int m) n=m; int return n;void disp() cout<<"n="<<n<<end1; ;void main()Sample s(10);(s--)++;s. disp();
填空题下列程序运行后的输出结果是{{U}} 【12】 {{/U}}。
#include<iostream.h>
void main()
{
int s=0,k;
for(k=7;k>=0;k--)
{
switch(k)
{
case 1:
case 4:
case 7:s++;break;
case 2:
case 3:
case 6:break;
case 0:
case5:S+;2;break;
}
}
cout<<"S="<<S<<endl;
}
填空题需求分析的步骤是需求获取、需求描述、需求验证和 【5】 。
填空题语句cout<<setiosflags(ios:: showpos)<<38<<""<<-38<<end1:的输出结果为{{U}} 【7】 {{/U}}。
填空题假定A为一个类,则语句A(A &a);为该类 【11】 函数的原型说明。
填空题将一个函数声明为一个类的友元函数必须使用关键字{{U}} 【8】 {{/U}}。
填空题{{U}}【14】 {{/U}}允许用户为类定义一种模式,使得类中的某些数据成员及某些成员函数的返回值能取任意类型。
填空题下列程序中的重载函数disp( )发生错误,错误原因是 【13】 。 # include<iostream, h> class Sample private: int m; static int sr; public: Sample(int a) m=a; st+=a; static void disp()cout<<m<<end1; static void disp(Sample input) cout<<input. m<<end1; ; int Sample: : st=2; void main() Sample Eirst(2), Second(4) Sample: :disp( ); Sample: :disp (Second);
填空题多数运算符既能作为类的成员函数重载,也能作为类的非成员函数重载,但口运算符只能作为类的{{U}} 【14】 {{/U}}函数重载。
填空题下面程序的运行结果是{{U}} 8 {{/U}}和{{U}} 9 {{/U}}。
#include<iostream.h>
#define N 10
#define s(x) x * x
#define f(x) (x * x)
void main( )
{ int i1,i2;
i1=1000/s(N) ;i2=1000/f(N) ;
cout < < i1 < < " " < < i2;
}
填空题若深度为5的完全二叉树的第5层有3个叶结点,则该二叉树一共有 [3] 个结点。
填空题下面程序执行完后k的值是 【8】 。 void main() unsigned num=26,k=1; do K * = num%10; num/ = 10; while(num); cout<<k;
填空题如果不使用多态机制,那么通过基类的指针虽然可以指向派生类对象,但是只能访问从基类继承的成员。下列程序没有使用多态机制,其输出结果是 【13】 。#include <iostream>using namespace std;class Base public:void print () ctout << 'B'; ;class Derived; public Base public:void print () cout <<'D'; ;int main()Derived* pd= new Derived();Base* pb = pd;pb->print();pd->print();delete pd;return ();
填空题下面程序的功能是将字符数组a中下标值为偶数的元素从小到大排列,其他元素不变,请填空。 #include<iostream.h> #include <string.h> void main() char a[]="clanguage",t; inti,j,k; k=strlen(a); for(i:0;i<=k-2;i+=2) for(j=i+2;j<=k; 【9】 ) if( 【10】 ) t=a[i]; a[i] =a[j]; a[j] =t; cout<<a; cout<<endl;
填空题函数swap(arr,n)可完成对arr数组从第1个元素到第n个元素两两交换。在运行调用函数中的语句后,a[0]和a[1]的值分别为 【9】 。 a[0]=1;a[1]=2;swap(a,2);
填空题请将下列类定义补充完整。 class Base(public:void fun()cout<<"Base::fun"<<end1;; class Derived:public Base public: void fun() ______//显式调用基类的fun函数 cout<<"Derived::fun"<<end1; ;