填空题非成员函数应声明为类的 【10】 函数才能访问这个类的private成员。
填空题排序是计算机程序设计中的一种重要操作,常见的排序方法有交换排序、选择排序和 【1】 等。
填空题在下面横线上填上适当的语句,完成程序。
#include <iostream>
using namespace std;
class Base
{
int x;
public:
Base(int i) {x=i;}
~Base(){}
};
class Derived: public Base
{
public:
______∥完成类 Derive 构造函数的定义
};
int main()
{
Derived Obj;
return 0;
}
在横线处应填入的语句是{{U}} 【11】 {{/U}}。
填空题从实现的角度划分,c++所支持的两种多态性分别是 【7】 时的多态性和运行时的多态性。
填空题有如下关系:学生(学号,姓名,性别,专业号,年龄),将属性年龄的取值范围定义在0-120之间符合{{U}} [5] {{/U}}。
填空题如果要把返回值为void的函数A声明为类B的友元函数,则应在类B的定义中加入的语句是{{U}} 【9】 {{/U}}。
填空题根据变量定义“static int x[5],y[2][3]={9,6,3,1,4,7};”,x[4]={{U}} [10] {{/U}},y[1][2]={{U}} [11] {{/U}}。
填空题有以下程序: #include <iostream> using namespace std; class CFactorial private: int value; int fact; public: CFactorial ( int val ); void CalculateFactorial(); void Display(); ; CFactorial :: CFactorial( int val ) value = val; fact = 1; void CFactorial :: CalculateFactorial() int i = value; while ( i > 1 ) fact *= i--; void CFactorial :: Display() cout<<value<<"!="<<fact<<end1; int main() CFactorial A( 5 ); A.CalculateFactorial(); A.Display(); return 0; 程序中,类CPactorial的功能是 【13】 ,该程序运行的结果是 【14】 。
填空题下面程序的输出结果是 【9】 。 #include < iostream.h> void main( ) int a[6]=1,2,3,4, 5,6; for(int i=0;i<5;i++) cout << a[i]<<" "; cout << end1;
填空题【 】是C++语言程序的入口。
填空题派生类对基类的继承有三种方式: ______、 ______,保护继承。
填空题若要访问指针变量q所指向的数据,应使用表达式______。
填空题类______支持输入操作,类______支持输出操作。
填空题C++在重载运算中,如用成员函数重载一元运算符参数表中需要 【8】 个参数,如用友元函数重载一元运算符参数表中需要1个参数。
填空题下列程序的输出结果是{{U}} 【8】 {{/U}}。
#include<iostream>
#include<cstring>
using namespace std;
void fun(const char *s,char }
int main()
{
char str[]="ABCDE";
char ch=str[1];
fun(str,ch);
cout<<ch;
return 0;
}
填空题有以下程序 #include<iostream> using namespace std; class MyClass public: static int s; MyClass(); 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->Set Value(k+1); p++; cout<<MyClaSS::s<<endl; retum 0; 运行后的输出结果是 【12】 。
填空题在派生类中使用基类的成员,可以显式地使用 【13】 来使用基类成员。
填空题下列程序的输出结果是{{U}} 【10】 {{/U}}。
#include<iostream>
using namespace std;
void fun (int &rf)
}
rf*=2;
}
int main()
{
int num:500;
fun(num);
cout<<num<<endl;
return 0;
}
填空题程序文件的编译错误分为语法错误和______两类。
填空题一个类可以从直接或间接的祖先中继承所有属性和方法。采用这个方法提高了软件的
______
。
