单选题有如下程序段,请指出”p所代表的是( )。 int **p,*s,k=20; S = &k; p = &s; A) s B) &k C) *p D) k
单选题下列关于虚函数的说明中,正确的是( )。
单选题在下列原型所示的C++函数中,按“传值”方式传递参数的是( )。 A) void f1(int x); B) void f2(int*x); C) void f3(const int*x); D) void f4(int&x);
单选题下面程序的运行结果是( )。
#include
using namespace std;
class TestClass
{static intn;
public:
TestClass 0
{
n++;
}
static int test()
{
for(int i=0;i<4;i++)
n++;
return n:
}
};
int TestClass::n=0:
int main()
{cout<
单选题以下程序的运行结果是 #include<iostream.h> void sub(int x,int y,int *z) *z=y-x; void main( ) int a,b,c; sub(10,5,&
单选题在C++中既可以用于文件输入又可以用于文件输出的流类是______。
单选题函数swap(a,n)可完成对a数组从第1个元素到第n个元素两两交换。其中b[0]=1;b[1]=2;swap(b,2)。在运行调用函数中的语句后,b[0]和b[1]的值分别为( )。 A) 1,1 B) 1,2 C) 2,2 D) 2,1
单选题在下列字符中,不允许作为C++标识符的是______。
单选题假定a=3,下列程序的运行结果是( )。
#include
int fun(intn);
void main()
{cout>a;
result=fun( a);
cout<
单选题以下程序的输出结果是( )。 #include<iostream.h> main() int m=5; if(m++>5) cout<<m; else cout<<m--; A) 7 B) 6 C) 5 D) 4
单选题下列选项,不正确的是( )。
单选题有如下程序: #inc1ude <iomanip> #inc1ude <iostream> using namespace std; int main(){ cout<<setfill('*')<<setw(6)<<123<<456; return 0; } 运行时的输出结果是( )。
单选题将运算符重载为类成员函数时,其参数表中没有参数,说明该运算符是( )。
单选题长度为n的简单插入排序法,最坏情况需要______ 次比较。
单选题在下列枚举符号中,用来表示“相对于当前位置”文件定位方式的是( )。
单选题下面对于友元函数描述正确的是
A.友元函数的实现必须在类的内部定义
B.友元函数是类的成员函数
C.友元函数破坏了类的封装性和隐藏性
D.友元函数不能访问类的私有成员
单选题有如下程序: #include<iostream> using namespace std; class Test public: Test() n+=2; ~Test() n-=3; static int getNum() return n; private: static int n; ; int Test::n=1; int main() Test *p=new Test; delete p; cout<<"n="<<Test::getNum()<<endl; return 0; 执行后的输出结果是( )。 A) n=0 B) n=1 C) n=2 D) n=3
单选题有以下程序:
#include <iostream>
using namespace std;
class count
{
static int n;
public:
count ( )
{
n++;
}
static int test()
{
for (int i = 0; i < 4; i++ )
n++;
return n;
}
};
int count :: n = 0;
int main()
{
cout<<count :: test()<<" ";
count c1, c2;
cout<<count :: test()<<end1;
return 0;
}
执行后的输出结果是
____
。
单选题下列函数的运行结果是( )。 #include<iostream.h> int f(int a,int b) int c; if(a>b)c=1; else if(a==b)c=0; else c=-1; return(c); void main() int i=2,j=3; int p=f(i,j); cout<<p;
单选题下列运算符中,
____
运算符在C++中不能重载。
