单选题有如下程序 main() {int n=9; while(n>6)<n--; cout<<n<<endl;} } 该程序段的辅出结果是
单选题下列叙述中正确的是
单选题下面程序的运行结果为 #include < iostream.h > void swap ( int &a,int b ) int temp; temp=a++; a=b; b=temp; void main( ) int a=2,b=3; swap(a,b) ; cout << a <<"," << b << end1;
单选题下面的概念中,不属于面向对象方法的是______ 。 A) 自顶向下 B) 继承 C) 类 D) 对象
单选题有如下类声明: c1ass SAMPLE { int n; public: SAMPLE(int i=0):n(i){} void setValue(int n0); }; 下列关于getValue成员函数的实现中,正确的是( )。
单选题有如下程序:
#include<iostream>
using namespace std;
class XX{
int x;
public:
XX(int XX=0):x(xx){}
int getX(){return x;}
};
class YY:public XX{
int y;
public:
YY(int xx,int yy):XX(xx),y(yy){}
int getV(){return getX()+y;}
};
int main(){
YY c(3,4);
cout<<c.getV()+c.getX()<<endl;
return 0;
}
运行这个程序的输出结果是______。
单选题下列程序的运行结果为
#include<iostream.h>
void main( )
{
int a=2;
int b=a+1;
cout < < a/b < < endl;
}
A) 0.66667 B) 0 C) 0.7 D) 0.66666666…
单选题运算符函数调用格式的表达式“y/x++”与表达式“y.operator/(operator++(x,0))”的含义相同,由此可看出( )。
单选题下列工具中为需求分析常用工具的是
____
。
单选题为完成下面的程序,在画线处应填入的语句是______。
#included<iostream>
using namespace std;
class Base
{
int x;
public:
Base(int i){x=i;}
~Base(){}
};
class Derived:public Base
{
public:
______//完成类Derived构造函数的定义
};
int main()
{
Derived obj(2);
return 0;
}
单选题下面是重载为非成员函数的运算符的函数原型,其中错误的是( )。
单选题有如下类模板定义: template<typename T> class BigNumbei long n; public; BigNumber(T i):n(i) BigNumber operator+(BigNumber b) return:BigNumber(n+b.n); ; 已知b1、b2是BigNumber的两个对象,则下列表达中错误的是( )。
单选题若执行语句:cout<<setfill("*")<<setw(10)<<123<<"OK"<<endl后将输出
____
。
单选题下列关于函数参数的叙述中,正确的是______。 A.在函数原型中不必声明形参类型 B.在调用一个函数时,若函数中修改了形参变量的值,则对应的实参变量的值也被修改 C.函数形参的生存期与整个程序的运行期相同 D.函数的形参在函数被调用时获得初始值
单选题有如下程序:
#include
using namespace std;
class Test{
public:
Test() {n+=2;}
~Test() {n-=3;}
static int getNum(){retum n;}
private:
static int n:
};
int Test::n=1;
int main()
{Test*p=new Test;
delete p;
cout<<"n="<
单选题有如下程序: #include<iostream> using namespace std; class A{ public: virtual void funcl(){cout<<”A1”;} void func2(){cout<<”A2”;} }; class B:public A{ public: void funcl(){cout<<”B1”;} void func2(){cout<<”B2”;} }; int main(){ A*P=new B: P->funcl(); P一>func2(); delete p; return 0; } 执行这个程序的输出结果是( )。
单选题下列关于派生类构造函数和析构函数的说法中,错误的是( )。
单选题下列关于C++流的描述中,错误的是( )。
单选题有如下程序: #include<iostream> using namespace std; class Test { public: Test() {n+=2;} ~Test(){n-=3;} static int getNum0{return n;} private: static int n; }; int Test::n=1; int main() { Test*p=new"rest; delete p; tout<<''n=''<<Test::getNum()<<end1; return 0; } 执行后的输出结果是( )。
单选题下列描述中,不属于面向对象思想主要特征的是