单选题执行下列语句序列: int i=0;while(i<25)i+=3;cout<<i; 输出结果是( )。
单选题有如下函数模板定义:
template
T1 FUN(T2 n){return n*5.0;}
若要求以int型数据9作为函数实参调用该模板,并返回一个double型数据,则该调用应表示为______。
单选题以下程序的运行结是______。
#include<iostream>
using namespace std ;
class Base {
char c;
public :
Base( char c0):c( c0) { }
~Base( ){cout<<c;}
};
class Derived:public Base{
char c:
public:
Derived( char c0): Base(c0+1) ,c(c0){}
~Derived(){cout<<e;}
};
int main(){
Derived obj("x");
return 0:
}
A) xy B) yx c)x D) y
单选题在为一个类重载下列运算符时,只能作为该类成员函数重载的运算符是______。
单选题两个或两个以上模块之间关联的紧密程度称为( )。
单选题下列程序的运行结果为( )。#include<iostream.h>void print(double a){cout<<++a:}void print(int a,int b){cout<<b<<a:}void main(){print(1.2);cout<<" ";print(3,4);}
单选题下列叙述中正确的是( )。
单选题以下程序的执行结果是( )。
#include
int fun(int b[],int n)
{int i,r=1;
for(i=0;i
单选题已知二叉树后序遍历序列是dabec,中序遍历序列是debac,它的前序遍历序列是 A)acbed B)decab C)deabc D)cedba
单选题有如下程序:
#include <iostream>
using namespace std;
class BASE{
char c;
public:
BASE(char n):c(n){}
virtual ~BASE(){cout<<c;}
};
class DERIVED:public BASE{
char c;
public:
DERIVED(char n):BASE(n+1),c(n){}
~DERIVED() {cout<<c;}
};
int main(){
DERIVED("X");
return 0;
}
执行上面的程序将输出______。
单选题下列( )是C++语言的有效标识符。
单选题下列函数模板的定义中,合法的是( )。
单选题有下列程序:
#include <stdio.h>
void main()
{ int x;
scanf("%d",&x);
if(x<=3);else
if(x!=10) printf("%d/n",x);
程序运行时,输入的值在哪个范围才会有输出结果______。
单选题有如下程序:
#include
using namespace std;
void fun(char c) { cout<<"char c / "; }
void fun(double d) { cout<<"double d / "; }
void fun(char* p) { cout<<"char *p / "; }
int main() {
fun(0);
return 0;
}
进行编译、链接、运行的结果是
单选题有如下的程序; #include <ctring> #include <iostream> using namespace std; class MyString { public: MyString(const char *s); ~MyString() {delete []data;} protected: unsigned len; char *data; }; MyString:: MyString (const char *s) { len=strlen(s); data=new char[len+1]; strcpy(data,s); } int main() { MyString a("C++ Programing"); MyString b(a); return 0; } 在运行上面的程序时出错,出错的原因是______ 。
单选题D解析:语句r= unc (func(x,y),z);中,fun(x,y)是一次调用函数,它的值作为func另一次调用的实参。注意本题调用两次函数。
单选题C++语言本身没有定义I/O操作,但I/O操作包含在C++实现中。C++标准库iostream提供了基本的I/O类。I/O操作分别由两个类istream和______提供。
单选题有如下程序:
#qnclude<iostream>
#include<iomanip>
using namespace std;
class CSum
{ int x,y;
public:
CSum(int x0,int y0):x(xo),y(yo){}
friend ostream
return os;
}
};
int main(){
CSum y(3.5};
cout<<setfill("*")<<8
cout<<y;
return0;
}
执行上面程序的输出是
单选题下列叙述不属于线性链表较之线性表顺序存储结构的优点的是
____
。
单选题有如下程序: #include<iostream.h> class Base protected:int i; public:int j; ; class Derived:public Base int m; public:int n; ; int main() Derived d; d.i=0; //[1] d.j=0; //[2] d.m=0; //[3] d.n=0; //[4] return 0; 其中主函数中有两个赋值语句有错,这两个错误的赋值语句是( )。