单选题下列关于类模板的叙述中,错误的是______。
单选题要建立文件流并打开当前目录下的文件file. dat用于输入,下列语句中错误的是( )。 A) ifstream fin = ifstream, open( "file. dat" ) ; B) ifstream * fin = new ifstream( "file. dat" ) ; C) ifstream fin; fin. open ( "file. dat" ) ; D) ifstream * fin = new ifstream() ; fin -> open( "file. dat" ) ;
单选题下面程序的运行结果是 #include<iostream,h> void
fun(int*a,int*b) { int X= *a;
* a= *b; *b=X; cout<< *a<< *b<<" ";
void main() int x=1, y=2;
fun(&x,&y);
cout<<X<<y<<end1; }
A.12 12
B.12 21
C.21 12
D.21 11
单选题若有下列定义
int x[10],*pt=x;
则对x数组元素的正确引用是______。
单选题下列语句段中不是死循环的是( )。
单选题函数fun的返回值是 fun(char*a,char*b) { int num=0,n=0; while(*(a+num)!='/0') nmn++; while(b[n]) {*(a+num)=b[n];num++;n++;} return num; }
单选题以下程序中调用cin函数给变量a输入数值的方法是错误的,其错误原因是 #include<iostream.h> void main( ) int * p, * q, a, b; p= cout < < "input a:"; cin >> p;
单选题下面程序的运行结果是______。
#include<iostream>
using namespace std;
void main()
{
int num=1;
int
ref=ref+2;
cout<<num;
num=num+3;
cout<<ref<<endl;
}
单选题下列各个选项中对字符数组赋字符串的语句中,错误的是( )。
单选题有如下类定义: class MyClass { int b;char a;double c; public: MyClass():c(0.0),b(0),a(','){} }; 创建这个类的对象时,数据成员的初始化顺序是( )。
单选题下面程序的结果为 #include"iostream.h" void
change(int a,int b) { int
temp; temp=a; a=b;
b=temp; } void main()
{ int m,n; m=8;
n=9; change(m,n);
cout<<m<<" "<<n<<endl; }
A. 8 9
B. 9 8
C. 程序有错误
D. 9 9
单选题程序中有如下语句for(int
i=0;i<5;i++)cout<<*(p+i)<<",";能够依次输出int型一维数组a的前5个元素。由此可知,变量P的定义及初始化语句是{{U}}
{{/U}}。
A. int*p=a;
B. int p=a;
C. *p=a;
D. p=a;
单选题有如下程序: #include<iostream> using namespace std; int main() { int *p; *p=9; cout<<''The value atp:''<<*p; return 0; } 编译运行程序将出现的情况是( )。
单选题有如下程序:
#include<iostream.h>
long fib(int n)
{ if(n > 2) return(fib(n-1)+fib(n-2) );
else return(2);}
void main( )
{ cout < < fib(3);}
该程序的输出结果是( )。
单选题在任意一棵二叉树中,度为0的结点总是比度为2的结点多( )。
单选题在C++中,cin是一个______。
单选题虚函数必须是类的( )。
单选题若要对类BigNumber中重载的类型转换运算符long进行声明,下列选项中正确的是( )。
单选题有如下程序:
#include<iostream>
using namespace std;
class Instrument{
public:
virtual void Display()=0;
};
class Piano:public Instrument{
public:
vold Display(){/*函数体程序略*/}
};
int main(){
Instrument s;
Instrument*p=0;
//...;
return 0;
}
下列叙述中正确的是______。
单选题下列链表中,其逻辑结构属于非线性结构的是
