单选题有如下程序: #include <iostream> void fun(intx=y;y=t; int main () int a[2]=23,42; fun(a[1],a[0]); std::cout<<a[0]<<","<<a[1]<<std::endl; return 0; 执行后的输出结果是 A) 42,42 B) 23,23 C) 23,42 D) 42,23
单选题有如下程序: #include<iostream> using namespace std; class Stack public: Stack(unsignedn=10):size(n)rep_=new int[size];top=0; Stack(Stack s):size(s.size) rep_=new int[size]; fbr(inti=0;i<size;i++)rep_[i]=s.rep_[i]; top=s.top; ~Stack( )delete[ ]rep_; void push(int
单选题下列数据结构中,能够按照“先进后出”原则存取数据的是( )。
单选题若有定义语句“int i=2,j=3;”,则表达式i/j的结果是( )。
单选题若MyClass为一个类,执行“MyClass a[4],*p[5];”语句时会自动调用该类构造函数的次数是______。
单选题求n阶勒让德多项式的递归函数定义如下: double P(double x, int n) { if(n==0) return 1; if(n==1) return x; if(n>1) return ((2*n-1)*x-P(x,n-1)-(n-1)*P(x,n-2))/n; }若执行函数调用表达式P(1.3,2),函数P被调用的次数是
单选题有以下程序: #include <iostream> #include <string> using namespace std; int main ( ) char b1[8] = "abcdefg"; char b2[8],*pb=b1+3; while (--pb>=b1) strcpy (b2, Pb) ; cout<<strlen (b2) <<end1; return 0; 程序运行后的输出结果是( )。
单选题下列情况中,不会调用拷贝构造函数的是( )。 A) 用一个对象去初始化同一类的另一个新对象时 B) 将类的一个对象赋值给该类的另一个对象时 C) 函数的形参是类的对象,调用函数进行形参和实参结合时 D) 函数的返回值是类的对象,函数执行返回调用时
单选题有下列程序: #include<stdio.h> void main() stuct STUchar name[9];char sex;double score[2];); stuct STU a="ZhaO",'m',85.0,90.0,b="Qian",'f',95.0,92.0); b=a; printf("%s,%c,%2.0,%2.0、n",b.name,b.sex,b.score[0],bscore[1]); 程序的运行结果是( )。
单选题有如下程序段:
int i=1;
while(1){
i++;
if(i==10) break;
if(i%2==0) cout<<"*";
}
执行这个程序段输出字符*的个数是______。
单选题执行下列程序的结果是
main( )
{
float x=1,y;
y=++x*++x;
cout<<y<<endl;
}
单选题有如下程序: #include <iostream> using namespace std; class Complex double re,im; public: Complex(double r, double i):re(r), im(i) double real() const return re; double image() const return im; Complex im+=a.im; return *this; ; ostream int main() Complex x(1,-2),y(2,3); cout<<(x+=y)<<endl; return 0; 执行这个程序的输出结果是( )。 A.(1,-2) B.(2,3) C.(3,5) D.(3,1)
单选题设n=10,i=4,则赋值运算n%=i+1执行后,n的值是( )。
单选题下列不属于C++规定的类继承方式是______。
单选题在多继承中,公有派生和私有派生对于基类成员在派生类中的可访问性与单继承的规则( )。 A.完全相同 B.完全不同 C.部分相同,部分不同 D.以上都不对
单选题有如下类定义: class Foo{ public:
Foo(int v):value(v){} //①
~Foo(){} //② private: Foo(
){{ //③ int value=0; //④
}; 其中存在语法错误的行是
A. ①
B. ②
C. ③
D. ④
单选题为了使类中的某个成员不能被类的对象通过成员操作符访问,则不能把该成员的访问权限定义为
单选题以下程序的输出结果是
____
。
#include<iostream.h>
main()
{
int m=5;
if(m++>5)
cout<<m;
else cout<<m--;
}
单选题软件是指( )。
单选题执行下列语句段后,输出字符“*”的个数是( )。for(int i=50;i>1;--i)cout<<'*';
