单选题若为Fraction类重载前增1运算符++,应在类体中将其声明为______。
单选题对长度为n的线性表进行顺序查找,在最坏情况下需要比较的次数为
____
。
单选题若有以下程序: #include <iostream> using namespace std; #define PI 3.14 class Point { private: int x,y; public: Point(int a,int b) { x=a; y=b; } int getx() { return x; } int gety() { return y; } }; class Circle : public Point { private: int r; public: Circle(int a, int b,int c) :Point(a,b) { r=c; } int getr() { return r; } double area() { return PI*r*r; } }; int main() { Circle c1(5,7,10); cout<<c1.area()<<end1; return 0; } 程序执行后的输出结果是( )。
单选题有以下程序 #include <iostream.h> float fun(int x,int y) return(x+y); void main() int a=2,b=5,c=8; cout<<fun((int)fun(a+c,b),a-c); 程序运行后的输出结果是( )。 A.编译出错 B.9 C.21 D.9.0
单选题设置虚基类的目的是{{U}} {{/U}}。
A.简化程序
B.消除二义性
C.提高运行效率
D.减少目标代码
单选题若已定义;
inta[]={0,1,2,3,4,5,6,7,8,9},*p=a,i;
其中0≤i=≤9,则对a数组元素不正确的引用是
____
。
单选题循环while (int i=0)i--;执行的次数是______ 。
单选题有如下程序: #include<iostream> using namespace std; class Pair{ int m,n; public: Pair(int j,int k):m(j),n(k){} int get0{return m;} int getoconst{return m+n;} }; int main(){ Pair a(3,5); const Pair b(3,5); cout<<a.get()<<b.get(); return 0; } 运行时的输出结果是( )。
单选题下列关于类、对象、属性和方法的叙述中,错误的是{{U}} {{/U}}。
A. 类是对一类相似对象的描述,这些对象具有相同的属性和方法
B. 属性用于描述对象的状态,方法用于表示对象的行为
C. 基于同一个类产生的两个对象可以分别设置自己的属性值
D. 通过执行不同对象的同名方法,其结果必然是相同的
单选题以下函数实现的功能是 ( )。 void fun(char *s) char *p,*q, temp; p=s; q=s+strlen (s) -1; while (p<q) temp=*p; *p=*q; *p=temp; p++; q--;
单选题下面对静态数据成员的描述中,正确的是______。
单选题函数swap(a,n)可完成对a数组从第1个元素到第n个元素两两交换。其中h[0]=1;b[1]=2;swap(b,2)。在运行调用函数中的语句后,b[0]和b[1]的值分别为( )。
单选题有下列程序:
#include<stdio.h>
void main()
{ FILE *pf;
char *s1="China",*s2="Beijing";
pf=fopen("abc.dat","wb+");
fwrite(s2,7,1,pf);
rewind(pf); /*文件位置指针回到文件开头*/
fwrite(s1,5,1,pf);
fclose(pf);
}
以上程序执行后abc.dat文件的内容是
____
。
单选题有如下的程序: #include<cstring.h) #ingclude<iostream.h) using namespace std; Class MyString public: MyString(const char*s); ~MyString()delete[]data; protected: unsigned len; char*data;; MyString::MyString(const char*S) len=stflen(s); dara=new char[1en+1]; strcpy(dara,s); int main() MyString a(“C++Programing”); MyString b(a); return 0; 在运行上面的程序时出错,出错的原因是( )。
单选题下面函数的功能是( )。 int fun(char *x) char *y=X; while(*y++); return (y-x-1);
单选题有如下定义:
int a[5]={1, 3, 5, 7, 9}, *P=a;
下列表达式中不能得到数值5的是______。
单选题以下程序的输出结果是( )。 #include<iostream.h> main() { in(b[3][3]={0,1,2,0,1,2,0,1,2},i,j,t=1; for(i=0,i<3:i++) for(j=i;j<=i;j++) t=t+b[i][b[j][j]]; cout<<t; }
单选题有如下类定义 class MyClass public: _________ Private: int data; }; 若要为MyClass类重载流输入运算符>>,使得程序中可以“cin>>obj;”形式输入MyClass类的对象obj,则横线处的声明语句应为( )。
单选题下面不属于软件工程的3个要素的是
____
。
单选题下列语句中,输出与众不同的是
