单选题下列程序的输出结果是 #include<iostream.h> void
main() {char*str="12123434"; int
x1=0,x2=0,x3=0,x4=0,i;
for(i=0;str[i]!='/0';i++) switch(str[i])
{case'1':x4++; case'2':X3++;
case'3':X2++; case'4':X1++;
} cout<<X1<<","<<X2<<","<<X3<<","<<X4;
A. 8,6,4,1
B. 8,6,3,2
C. 8,8,4,1
D. 8,6,4,2
单选题每个C++程序都必须有且仅有一个______。
单选题C++系统预定了4个用于标准数据流的对象,下列选项中不属于此类对象的是( )。
单选题为用户与数据库系统提供接口的语言是( )。
单选题执行以下程序后的输出结果为( )。 #include <iostream> Using namespace std; void fun(int x,int y,int *cp,int *dp) *cp=x+y;*dp=x-y;) void main() int a,b,c,d; a=30; b=50; fun(a,b, cout>>c>>','<<d<<endl; A.50,30 B.30,50 C.80,-20 D.80,20
单选题若一个函数的原型为“int*Xfunl(int x,int”,则该函数的返回值类型为( )。
单选题下列关于指针的运算中,( )是非法的。
单选题以下类定义中可能会引起错误的语句是( )。 Class A public: ~A()//1 int i;//2 private: int j;//3 A(int i)i++;//4 ;
单选题有如下类声明:
class SAMPLE
{
int n;
public:
SAMPLE(int i=0):n(i) {}
void setValue(int n0);
};
下列关于getValue成员函数的定义中,正确的是______。
单选题下列对字符数组进行初始化的语句,正确的是( )。
单选题下列表达式的值为false的是
____
。
单选题在公有继承的情况下,允许派生类直接访问的基类成员包括______。 A.公有成员 B.公有成员和保护成员 C.公有成员、保护成员和私有成员 D.保护成员
单选题有如下函数模板定义: template<class T> T func (T x,T y){return x*x+y*y;} 在下列对func 的调用中,错误的是______ 。
单选题阅读以下程序
#include<fstream.h>
void main( )
{
ifstream infile;
ofstream outfile;
fstream iofile;
iofile.open("a.txt",ios::in);
iofile.close( );
iofile.open("b.txt",ios::out);
}
下列描述错误的是
单选题有如下函数模板定义:
tempiate<typename T1,typename T2>
T1 FUN(T2 n){return n*5.0;}
若要求以int型数据9作为函数实参调用该模板,并返回一个double型数据,则该调用应表示为______。
单选题有如下程序: #include<iostream> using namespace std; class XA int a; public: static int b; XA(int aa):a(aa)b++; ~XA() int get()return a; ; int XA::b=0 int main() XA d1(1),d2(3); cout<<d1.get()+d2.get()+XA::b<<end1; return 0; 运行时的输出结果是( )。
单选题已知类A有公用数据成员a,并重载了“=”运算符,且有A obj2;const A*ptr new A;则下列语句错误的是( )。
单选题设有课程关系模式:R(C#,Cn,T,TA)(其中C#为课程号,Cn为课程名,T为教师名,Ta为教师地址),并且假定不同课程号可以有相同的课程名,每门课程只有一位任课教师,但每位教师可以有多门课程。关系R范式最高达到
单选题下面程序的输出结果是 #include<iostream.h> class A public: A( ) cout < < "construtA" < < endl; Virtual~A( ) cout < < "destructA" < < endl;; class B: public A ; class C:public A ; class D:public B,public C ; void main( ) D d;
单选题实现运行时的多态性要使用( )。 A.重载函数 B.析构函数 C.构造函数 D.虚函数